Home Download Buy Blog Forum Support

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

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

Postby canoeberry on Fri Feb 07, 2014 5:49 pm

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 ...
canoeberry
 
Posts: 10
Joined: Tue Feb 04, 2014 11:35 pm

Re: want to confirm: there is no way to find regex backwards?

Postby tito on Fri Feb 07, 2014 5:54 pm

Use view.find(pattern, fromPosition, <flags>) on which fromPosition is current position - something..
http://www.sublimetext.com/docs/3/api_reference.html
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 878
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

Re: want to confirm: there is no way to find regex backwards?

Postby canoeberry on Fri Feb 07, 2014 7:56 pm

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.
canoeberry
 
Posts: 10
Joined: Tue Feb 04, 2014 11:35 pm


Return to Plugin Development

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests