Desktop User Guides > Professional > Using UNICOM Intelligence Professional > Finding and replacing text > Using regular expressions to find text
 
Using regular expressions to find text
To search for text in your script, you can use regular expressions. Open either the Find pane or the Replace pane, and then select Use. When you click Find Next, the search string is evaluated as a regular expression.
When a regular expression contains characters, it usually means that the text being searched must match those characters. However, regular expressions use a number of characters that have a special meaning. The following table provides a summary of the most common special characters used in regular expressions. The special characters are shown in bold and are case‑sensitive; for example, \U is not the same as \u.
Regular expression
Description
.
Any character (including newline)
[abcn-z]
Any of the characters a, b, c, n, o, p, ..., z
[^abcn-z]
Any characters except a, b, c, n, o, p, ..., z
\w
Any alphanumeric character (including accents) or underscore (_)
\l
Any lower-case character (including accents)
\u
Any upper-case character (including accents)
\d
Any numeric character
\s
A whitespace character
^xxx
xxx at the beginning of a line
xxx\r$
xxx at the end of a line. In UNICOM Intelligence Professional, you must use \r$ to find text at the end of a line instead of the more typical $.
xxx|yyy
Either xxx or yyy
(xxx)
Grouping (subexpression)
x*
Zero or more occurrences of x
x+
One or more occurrences of x
x?
Zero or one occurrences of x
(xxx){ m }
Exactly m occurrences of xxx
(xxx){ m , n }
At least m and at most n occurrences of xxx
\
The escape character that you use to match characters that have a special meaning in regular expressions, such as the following characters , . ? { } [ ] ( ) $ ^ *. For example, to match the { character, you would specify \{.
Examples of regular expressions
Expression
Matches
abcd
The character sequence abcd anywhere in a line
^abcd
The character sequence abcd at the beginning of a line
^\s*abcd
The character sequence abcd at the beginning of a line after zero or more spaces
abcd\r$
The character sequence abcd at the end of a line
\.txt\r$
The character sequence .txt at the end of a line
[^A-Z]+
Any character that is not an uppercase English letter
[0-9]+\r$
Any digits in the range 0-9 that appear at the end of a line
^\$
A dollar sign at the beginning of a line
\[\]
The [ character and the ] character
For more information about regular expressions, see:
http://www.boost.org/doc/libs/1_57_0/libs/regex/doc/html/boost_regex/syntax.html
See also
Finding and replacing text