SlickEdit Community
Archived Beta Discussions => SlickEdit 201x Beta Discussions => SlickEdit 2017 v22 Beta Discussion => Topic started by: jporkkahtc on August 29, 2017, 11:58:29 PM
-
In the regex tool I was playing with a regex to match a path.
Open the attached TXT file.
In Find, do a Perl RE search in that file with this pattern
([a-zA-Z]:)?([\\/]*[^\r\n<>:"\\/|?*]+)+[\\/]?\(([0-9]+)\):
And slick hangs.
-
Reproduced. Thanks for the small sample
-
It turns out that this is a really slow regex. If you let it run for a very long time, it will finish. On my machine (pretty fast windows machine), it takes about 62 seconds to finish.
If I hold down Ctrl+Alt+Shift+F2, the search is cancelled.
-
Thanks.
Can you give any advice on why it is so slow and how to improve it?
I tried a number of things, but it seemed that as I made changes it would go from being quick to being *really* slow - not a lot of in between.
I tried replacing "+" with "+?" and "++". Especially with ++ I expected it to make a perf difference.
-
Without spending too much time on it I tried this:
([a-zA-Z]:)?+([\\/]*+[^\r\n<>:"\\/|?*]++)+:
I got rid of most of the backtracking. I'm not sure what you were trying to accomplish with the regex stuff after what I used.