Sublime Forum

Want to confirm: there is no way to find regex backwards?

#1

I am trying to write a plugin and in it I am hoping to search backwards with a regex. No can do!

The only thing I can find is, Do a find_all(…) instead, and pick the one which is closest to but not greater than your starting position.

Not good. Is that really my only choice? I realize computers are really fast nowadays but still I hate doing a huge amount more work than necessary …

0 Likes

#2

Use view.find(pattern, fromPosition, ) on which fromPosition is current position - something…
sublimetext.com/docs/3/api_reference.html

0 Likes

#3

Thanks for your recommendation.

I don’t think that’s any good though. So instead I will just search the entire buffer.

This should be fixed but I will just chill out about it.

0 Likes