Which regular expression engine?

Benct Philip Jonsson 11 years ago in General updated by Benct Philip Jonsson 8 years ago 3
Thanks for a great app! I have some questions regarding regular expressions, though:

- Which regular expression engine does Textastic use?
- Where can I find the syntax spec?
- What is the right syntax for including captures in the replacement text?
- Can I use case modifiers like \U \L \u in the replacement text?

TIA for the answer which I hope end up in the FAQ/manual! (Is there a FAQ distinct from the manual?

Search and Replace in Textastic for iPhone and iPad uses the NSRegularExpression class which in turn uses the syntax that is specified by ICU. 

See http://developer.apple.com/library/mac/#documentation/Foundation/Reference/NSRegularExpression_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40009708-CH1-SW53 



Textastic supports the same replacement string syntax as TextMate. See http://manual.macromates.com/en/regular_expressions#replacement_string_syntax_format_strings

You can reference captures using $1, $2 etc.

Case foldings and conditional insertions are supported as described in the TextMate manual.

OK thanks! A rather Perlish syntax which is good from my POV. Outside the phone I'm on Linux or occasionally Windows + Vim so my experience with Textmate is nil. Nice syntax for conditional branching in the replacement!

Three years later (time flies) the `(?:CAPTURENUMBER:IF-MATCH:ELSE) syntax doesn't work anymore (on iOS)? I haven't used it in a while