Regular expressions

Proteus supports two types of regular expressions: simple and extended.

Extended regular expressions

Extended regular expressions are more powerful, but also more complex to use; they consist in a string of characters where a few are interpreted literally, while others are control characters with a special meaning. This is a brief explanation about them:

The evaluation order for operators at the same level of parenthesis is (from highest to lowest priority):

[] *+? concatenation |

A few examples of extended regular expressions (used by REXMATCH, REXIMATCH and others):

"^a" accept any string beginning with 'a'
"^apples" accept any string beginning with 'apples'
"a$" accept any string ending with 'a'
"oranges$" accept any string ending with 'oranges'
"f..e" accept any string of 4 letters beginning with 'f' and ending with 'e' (e.g. 'free', 'fare' but not 'force')
"[ab]" accept any string containing 'a' or 'b'
"[^ab]" accept any string not containing 'a' and 'b'
"^[0-3][0-9]/[0-1][0-9]/[0-9][0-9]$" accept any date (like "30/12/97")
"su(m|n)" accept any string containing the word 'sum' or 'sun' (not 'su')
"worl?d" accept any string containing "word" or "world"
"^[0-9]*$" accept an empty string or a number containing only the digits '0'-'9'
"^[a-zA-Z]+[a-zA-Z0-9]*$" accept an identifier name (start with a letter, can contain only alphanumeric characters, is at least one character long)
"^(hello)|(goodbye)$" accept only the two strings 'hello' and 'goodbye'

Additional details can be found here.

Simple regular expressions

Simple regular expressions are easier to use than extended regular expressions; they only include two special characters:

The comparis is case-unsensitive when using the function IMATCH:

"b*o" matches "bo", "boo", "BO", "BriO" and so on.

A few examples of simple regular expressions (used by MATCH, IMATCH and others):

"*su?*" accept any string where the two characters 'su' are followed by a single character (e.g. 'sum', 'sun', etc.)
"c*" accept any string starting with 'c'
"*a" accept any string ending with 'a'
"???" accept any string 3-character long
"*one*two*three*" accept any string including the words 'one', 'two' and 'three' in this order

Additional details can be found here.

Start of page Next topic Previous topic Contents Index
Midnight Lake iPhone Case Black Women Shoes Black Flat Shoes Leather Flats Black Patent Ballerinas Black Ballet Shoes Casual Shoes Black Shoes Women Balle Record Player Cufflinks Best iPhone XR Clear Cases iPhone XS/XS Max Leather Cases Sale Best iPhone 8/8 Plus Silicone Cases iPhone 7/7 Plus Cases & Screen Protector New Cases For iPhone 6/6 Plus iPhone 8 Case Sale iPhone Xr Case Online iPhone 7 Case UK Online iPhone X Case UK Sale iPhone X Case Deals iPhone Xs Case New Case For iPhone Xr UK Online Case For iPhone 8 UK Outlet Fashion Silver Cufflinks For Men Best Mens Cufflinks Outlet Online The Gold Cufflinks Shop Online Cheap Shirt Cufflinks On Sale Nice Wedding Cufflinks UK Online Top Black Cufflinks UK Online Mens Cufflinks Online Silver Cufflinks For Men Men Cufflinks UK Sale Gold Cufflinks UK Online Gold Cufflinks UK Silver Cufflinks UK Shirt Cufflinks Discount Online Mens Cufflinks Deals & Sales Girls Shoes For Dance Fashion Ballet Dance Shoes Best Ballet Flats Shoes UK Online Cheap Ballet Pointe Shoes UK Online Best Ballet Shoes Outlet Best Dance Shoes Sale Cheap Ballet Flats Sale UK Best Pointe Shoes Online UK Ballet Dance Shoes UK Shoes For Dance UK Best Ballet Slippers Shop Best Yoga Shoes Hotsell