Sublime Forum

Question about View.find/find_all pattern

#1

Is the pattern not a python regex pattern?

0 Likes

#2

No, the API does not use Python as the regular expression engine. I think it’s boost?

2 Likes

#3

Well, :shrug:

That’s why it requires a string, and can’t use any of (?x), (?P<..>), (?P=..), OK…

0 Likes

#4
view.find_all('(?x)(?<test>test)\g<test>')

works just fine, not sure why you’d want to restrict yourself to Python 3.3’s re module’s limited functionality…

3 Likes

#5

St uses boost pretty much everywhere it doesn’t need backwards compatibility with old textmate resources (tmPreferences, syntax definitions).

2 Likes

#6

Well, just didn’t know what syntax can be used here.

0 Likes

#7

Thanks everyone.

0 Likes

#8

Here’s a quote from docs.sublimetext.info for Search and Replace:

Sublime Text uses the Perl Compatible Regular Expressions (PCRE) engine from the Boost library to power regular expressions in search panels.
Here’s the link:
https://www.boost.org/doc/libs/1_69_0/libs/regex/doc/html

0 Likes