File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -123,9 +123,12 @@ The following commands are available:
123123<dt ><tt >REGEX(< ; value> ; str [, < ; variable> ; name])</tt ></dt >
124124
125125<dd >Match the extended regular expression 'str', which must be of
126- string type. Matching is performed greedily, while '.' (a dot)
127- does not match a newline. Optionally assign the matched string to
128- variable 'name'.</dd>
126+ string type. Matching is performed greedily and '.' (a dot)
127+ matches a newline, use <tt>[^\n]</tt> to work around this.
128+ Optionally assign the matched string to variable 'name'. Note that
129+ since some string characters have to be escaped already, you might
130+ need to double escape them in a regex string. For example, to
131+ match a literal backslash, enter <tt>\\\\</tt>.</dd>
129132
130133<dt ><tt >ASSERT(< ; test> ; condition)</tt ></dt >
131134
Original file line number Diff line number Diff line change @@ -1089,7 +1089,7 @@ void checktoken(command cmd)
10891089
10901090 else if ( cmd.name ()==" REGEX" ) {
10911091 string str = eval (cmd.args [0 ]).getstr ();
1092- regex regexstr (str);
1092+ regex regexstr (str,regex::extended );
10931093 match_results<string::const_iterator> res;
10941094 string matchstr;
10951095
Original file line number Diff line number Diff line change 11SET(foo="bar.*")
22STRING(foo) NEWLINE
3- REGEX(foo) NEWLINE
3+ REGEX(foo) # Note that '.' also matches newlines and ERE is greedy.
Original file line number Diff line number Diff line change 11REGEX("\\\\(foo|(bar|baz))\
2- x\n[\\.-\\ }]") NEWLINE
2+ x\n[.- }]") NEWLINE
Original file line number Diff line number Diff line change 1- REGEX(".*") NEWLINE
1+ # Note that ERE '.' also matches newlines!
2+ REGEX("[^\n]*") NEWLINE
23SET(a=1/2)
34ASSERT(a == 0.5)
Original file line number Diff line number Diff line change 1- REGEX(".*") NEWLINE
1+ # Note that ERE '.' also matches newlines!
2+ REGEX("[^\n]*") NEWLINE
23SET(a=1/2.)
34ASSERT(a == 0.5)
You can’t perform that action at this time.
0 commit comments