Working With Items → Searching for Work Items → Search Criteria for Work Items → Regular Expression Operators
Regular expression queries in the Work Center search support the regexp and query_string queries. The Work Center search regular expression engine does not allow all types of regular expression operators.
This section describes the supported operators.
In Work Center, a regex search is automatically wrapped with the ^ or $ anchors to address full-word content. During a search, the regex is applied to each word in an item's text fields. If at least one word an item corresponds to the given regex, that item is returned in the search results. This means you do not need to use ^ or $ before or after your string.
For example, to find the string "DEF1234" you can use:
DEF123.+
This returns a match for "DEF1234". However, this does not:
DEF123
You can use any Unicode character in your query, except for the following reserved characters, which must be escaped:
. ? + * | { } [ ] ( ) " \Note that when using the optional operators listed below, the following characters are also reserved:
# & < > ~
To escape a reserved character, use a backslash "\*". To escape a backslash, use "\\".
\~smile:-\) “~smile:-)”
Use the plus symbol "+" to match the preceding element one or more times. The following matches string "DMPROD_EEC_22239":
DMPROD_E+C_2+39
Use a period "." in place of any character. The following matches string "DMPROD_EEC_22239":
DMPROD_EEC_2..39 .+_EEC_.+
Use an asterisk "*" to match the preceding element zero or more times. The following matches string "DMPROD_EEC_22239":
DMPROD_EE*C_2*39
Use a question mark "?" to match the preceding element zero or one time (in other words, make it optional). The following matches string "DMPROD_EEC_22239":
DMPROD_EE?C_2222?39
However, this does not:
DMPROD_E?C_22?39
Use curly brackets {} to match the preceding element at least n times, but no more than m times, where n and m are integers. For example:
The following match string "DMPROD_EEC_22239":
DMPROD_E{2}C_2{3}39 DMPROD_E{1,2}C_2{2,4}39 DMPROD_E{2,}C_2{3,}39
However, this does not:
DMPROD_E{3}C_2{4,}39
Use parentheses "()" to form sub-expressions. Use the quantity operators above to operate on the shortest previous element as a group.
The following match string "DMPROD_EEC_22239":
DMPROD(_EEC)+_22239 .+(_EEC){1,}.+
However, this does not:
(_EEC){1,}
Use the pipe symbol "|" as an OR operator. This means a match is found if either the left side of the pipe symbol is found or if the right side of the pipe symbol is found. The alternation applies to the longest patter, not the shortest.
The following match string "DMPROD_EEC_22239":
DMPROD_EEC.+|DMDEV_EEC.+ DMPROD(_EEC|_ABC).+
However, this does not:
.+_12345|.+_54321
To match a string that contains a range of characters (e.g. "DEF-12345):
Use square brackets [] to indicate a range of characters:
[DEF]+-12345
Use a dash - to specify a range of characters within square brackets.
[D-F]+-12345
The dash is literal if it is used as the first character or if it is properly escaped \-:
[-EFD]+12345 [EDF\-]+12345
Use a leading carat ^ to specify characters that must not appear for a match to occur:
[^INT]+-12345
However, these do not match:
[DEF-]+12345 [^A-Z]+-12345
Available optional operators are listed below.
Use the tilde symbol "~" to negate the shortest pattern that follows it. For example, when using an expression like "xy~z1":
The following match string "DMPROD_EEC_22239":
DMPROD_~A9 DMPROD_~(ABC)_22239
However, this does not:
DMPROD_~(EEC)_22239
Copyright © 2013–2018 Serena Software, Inc., a Micro Focus company. All rights reserved.