javascript - Slow performance if a character present after $ in regex -
var longstr = new array(30000).join("a"); longstr.replace(/(.*?)\s*$d/, "$1");
i have above code trim white space nowadays @ end of string. above code takes lot of time execute (~3sec), character "d" there after $ symbol reason bottleneck, removing "d" resolves issue.
i need know happens if character nowadays after $ symbol.
it doesn't matter nowadays after $
(not escaped literal dollar), since signifies end of line , nothing can there after line ends.
javascript regex performance
No comments:
Post a Comment