Page 1 of 1

Regular Expression Syntax

Posted: 5 Oct 2015 19:11
by Harrison Pratt
Is there a reference for the syntax used in the VIP regex match and search predicates? Several different "flavors" of regex exist and I'm having trouble using a few of the common expressions.

For example,

Suppose that I want to search the string "_x1239999" for "_x12".

Using the regular expression "_x\d\d" will match the substring "_x12" when I use the IDE search/replace dialog to test a regex search in my source code.

Some regex syntaxes permit using "_x\d{1,2}" to match the substrings "_x1" and "_x12", but the IDE Search dialog indicates "No match" under the Find field. Is there an equivalent syntax using the VIP regex search?

Posted: 6 Oct 2015 8:58
by Thomas Linder Puls
The regular expression in the editor and in PFC are unfortunately not the same. The reason is that the editor uses some (quite simple) "built-in" regular expression syntax of the scintilla editor.

Whereas PFC contains an instantiation of boost regular expressions, so unfortunately you cannot use one to gain knowledge of the other.

See also Boost.Regex and Scintilla.

Posted: 6 Oct 2015 21:59
by Harrison Pratt
Very clear now -- Scintilla doesn't support counts of characters (e.g., {x,y}) or newlines within expressions. http://www.scintilla.org/SciTERegEx.html

I understand why you wouldn't want to write VP's own text editor just to add a few regex features. It was trivial to add a regex testing dialog to my programming toolkit (written in VIP 7.5, of course). :D