| Version 3.4.4 |
| Regular expressions |
The regular expressions that you can use in the search and replace dialogs and in places like the 'Feature' attributes, the 'Primary index' of an 'Item' node or in checks all use standard Java regexp syntax. Before QF-Test version 3.1 the default was the GNU regexp package (see also appendix E). It can still be activated via the option Use old-style GNU regexps (from before QF-Test version 3.1). One major difference between the two is that '{' and '}' are special characters that need to be escaped with '\' for Java regexps, but normal characters for GNU:
Detailed regexp documentation with links to further information and even a whole book
about regular expressions are provided in the Java documentation for the class
java.util.regex.Pattern at http://download.oracle.com/javase/1.4.2/docs/api/java/util/regex/Pattern.html.
It's also worth to have a look at the Wikipedia article
about regular expressions.
Following is a short summary of the basics:
StackOverflowException with Java regexps, so if QF-Test finds this
expression in any regular expression it will treat it as a GNU regexp regardless of
the option setting.
$n in the replacement string expands to the
part of the original value matched by the nth
group. Example: To change the extension of file names starting
with /tmp/ from .foo to
.bar, search for (/tmp/.*)\.foo and
replace with $1.bar.
Examples:
'.*tree.*'.
'(?s).*' for Java
regexps and '(.|\n)*' for GNU.
'(.*)tree(.*)' to search and $1node$2 to
replace. In the replace dialog simply replace tree
with node and disable the "Match whole string" check
box to achieve the same effect.
'names?'
'(tree|node)'
| Last update: 01/27/2012 Copyright © 1999-2012 Quality First Software GmbH |