Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving the regular expression #23

Open
titoBouzout opened this issue Jan 9, 2012 · 4 comments
Open

Improving the regular expression #23

titoBouzout opened this issue Jan 9, 2012 · 4 comments

Comments

@titoBouzout
Copy link
Contributor

Most of the execution time of this package is on the call view.find_all or view.find which uses a regular expression to search for the words, returning the regions used.

Currently the regular expression is :

'(?<![\\w])'+re.escape(string)+'\\b'

Can you thing on a way to improve it?
There is also situations on which this expression raises:

RuntimeError: The complexity of matching the regular expression exceeded predefined bounds.  Try refactoring the regular expression to make each choice made by the state machine unambiguous.  This exception is thrown to prevent "eternal" matches that take an indefinite
@adzenith
Copy link
Member

adzenith commented Feb 8, 2012

It seems like a pretty straightforward regex... I'm not sure why the error talks about its complexity, unless we're running it when there's a huge selection or something. There's no branching or anything, so I'm not sure how we could dial it in.

@cpagravel
Copy link

I get the same thing: ^(\s+)+((?:if|foreach|while) (.*)) ([a-z]|$)

@adzenith
Copy link
Member

@chrisgravel did you get that error while running WordHighlight, or just while searching?

@cpagravel
Copy link

I got it just while searching. I realize now that my comment is invalid, I thought this was for Sublime Text dev, not one of the plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants