Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Scroll Table Layout
widths33%,33%,34%

Character/meta-characterMatchesExamples

anystring

an occurrence of the string “anystring”

“soft” matches parasoft, software, soften, etc.

.

exactly one non-null character

“.at” matches hat, cat, bat, fat, etc., but not “at”
w...ing matches webking, working, but not “what a king” or “wing”

?

0 or 1 occurrences of the preceding character

“j?test” matches either jtest or test

*

0 or more occurrences of preceding character

“a*soft” matches asoft, or aaaaasoft;
“.*ing” matches webking, waning, wing, what was that thing

+

1 or more occurrences of the preceding character

“a+soft” matches aaaaasoft, or aaasoft, but not asoft

[ ]

matches one occurrence of any character inside the brackets; ^ inverts the brackets metacharacter

“[cpy]up” matches cup, pup, or yup
“rule0[1-4]” matches rule01, rule02, rule 03, rule 04
“[^ch]at” matches all 3 letter words ending with “at” except for cat and hat.

[A-Z]

any uppercase letters from A to Z

“[A-Z]” matches any uppercase letter from A to Z

[a-z]

any lowercase letters from a -z

“[a-z]” matches any lowercase letter from a-z

[0-9]

any integer from 0 to 9

“rule[0-9]” matches any expression that begins with “rule” and ends with an integer

(?i)

ignore case

“(?i)ParaSoft” matches ParaSoft, PARASOFT, parasoft or paraSOFT

{}

like *, but the string it matches must be of the length specified in the braces

“a{2}” matches aa, aaa, aaaa, etc.
“a{3,}” matches at least 3 occurrences of the preceding character (aaaaa, or aaaaaaaa, but not aa
“a {2,5}” matches between 2 and 5 occurrences of the preceding character (aaa, aaaaaa, but not aa or aaaaaaaaaaaaaaaaaa)
“^(a{2})$” matches only aa

|

matches the string before the “|”, the string after the “|”, or both

“rulewizard|codewizard” matches rulewizard, codewizard, or both

Additional Information

  • The caret symbol (^) indicates the beginning of a string in parentheses. The dollar sign ($) indicates the end of a string in parentheses. Thus, to get an exact match for a string, use the format ^(STRING)$. For example ^(soft)$ would only flag “soft”.
  • If you want a violation reported if the expression is detected, disable the Regexp window’s Negate option.
  • If you want a violation reported when the expression is not detected, enable the Regexp window’s Negate option.
  • Regular expressions searches are case sensitive by default.
  • When using regular expressions, the backslash (\) is an escape character that you can use to match a "." , "*", or another character that has a non-literal meaning.