Should have a new release out tonight hopefully; if not, tomorrow for sure.
I have the “searching by scope and then applying regex to the scope region” feature pretty much done (I am skipping literal find and replace for now). Something to note though, due to the nature of Python’s subn function, you need to be careful with optional captured groups. Normally you will expect something like this to return an empty string for group 1 if this or that is not found.
(this|that)?(SomethingElse)
But subn, which I am using for applying regex to the the scope region, will return “unmatched group error” if you try and access group 1 and group 2 when this or that is not found.
You can still use the “?” in all sorts of other instances, but it might give you issues if you try and use it on a group. There are probably other scenarios you might need to be mindful of.
So to fix this, you would have to provide an empty option. This probably makes the “?” mark unneeded now, but I just want to illustrate what you have to do to fix the error.
(this|that|)?(SomethingElse)
This only applies to regex applied to scope regions. Regex with scope qualifiers goes through ST2’s api which does not suffer from this.
I could use Python’s findall function, but then I have to perform some coding gymnastics which I am not anxious to do right now, maybe down the road; we will see.
I also modified the folding command to not fold the trailing newline at the end of a selection. This makes folding regex much better, especially when targeting scopes like comments.
I also added a “mark” and “unmark” command where you can permanently highlight regions based on regex and also clear them; not sure how much use one might get out of this one, but it was easy to add, so I went ahead. It might come in handy.