Regular Expression Syntax

Discussions related to Visual Prolog
Harrison Pratt
VIP Member
Posts: 311
Joined: 5 Nov 2000 0:01

Regular Expression Syntax

Unread post by Harrison Pratt » 5 Oct 2015 19:11

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?

User avatar
Thomas Linder Puls
VIP Member
Posts: 1158
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 6 Oct 2015 8:58

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.
Regards Thomas Linder Puls
PDC

Harrison Pratt
VIP Member
Posts: 311
Joined: 5 Nov 2000 0:01

Unread post by Harrison Pratt » 6 Oct 2015 21:59

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

Post Reply