6

What regex syntax does Sublime Text use? POSIX? POSIX Extended?

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
Louis
  • 2,548
  • 10
  • 63
  • 120

1 Answers1

13

Sublime Text's Find and Replace functions, along with snippets, are powered by Boost's (Perl-Compatible Regular Expressions) engine. For syntax highlighting, Sublime Text 3 and 4 use a custom -compatible engine, with fallback to Oniguruma itself, for .sublime-syntax files. Oniguruma is used for the older tmLanguage format, and was the only engine used for syntax highlighting in Sublime Text 2.

MattDMo
  • 100,794
  • 21
  • 241
  • 231
  • That engine doesn't seem to support all PCRE patterns, e.g. `\p{Zs}`. – msoutopico Apr 28 '23 at 05:16
  • @msoutopico I believe there have been significant changes to the regex engine in Sublime Text 4, although I can't remember off the top of my head whether it was just for syntax highlighting, or both that and Find/Replace. The best place to ask would be [Discord](https://discord.gg/HcmwdVK), as some of the devs hang out there, along with others who are extremely knowledgeable about Sublime's internals. – MattDMo Apr 28 '23 at 16:43
  • @msoutopico also, do you know in what version `Zs` was added to PCRE? It may be that Sublime uses an earlier version, or that it's in a module that wasn't included... – MattDMo Apr 28 '23 at 16:48