SlickEdit Community

Archived Read Only Forums => SlickEdit 2017 v22 Beta Discussion => Topic started by: jporkkahtc on August 29, 2017, 11:58:29 pm

Title: Slick hang in perl RE search
Post 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.
Title: Re: Slick hang in perl RE search
Post by: Clark on August 31, 2017, 02:39:52 pm
Reproduced. Thanks for the small sample
Title: Re: Slick hang in perl RE search
Post by: Clark on August 31, 2017, 03:16:12 pm
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.
Title: Re: Slick hang in perl RE search
Post by: jporkkahtc on August 31, 2017, 04:35:33 pm
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.

Title: Re: Slick hang in perl RE search
Post by: Clark on August 31, 2017, 10:13:39 pm
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.