Regular Expressions
- Aktualisiert2025-07-21
- 2 Minute(n) Lesezeit
Regular Expressions
TestStand supports a limited subset of regular expression syntax that other applications or operating systems support. A regular expression in TestStand can contain any of the following tokens:
| Token | Explanation | Example |
|---|---|---|
| . (period) | Match 1 character. | a.t matches act and apt but not abort or at |
| * (asterisk) | Match 0 or more occurrences of the preceding character or {expression}. | 0*1 matches 1 , 01 , 001 , etc. a.* matches act , apt , abort , and at |
| + (plus sign) | Match 1 or more occurrences of the preceding character or {expression}. | 0+1 matches 01 , 001 , 0001 , etc. {ab}+c matches abc, ababc, but not c |
| ? (question mark) | Match 0 or 1 occurrences of the preceding character or {expression}. | 0?1 matches 1 , 01 , but not 001 |
| | (pipe) | Matches either the preceding or following character or {expression}. | a3|4b matches a3b or a4b |
| ^ (caret) | Matches the beginning of a line. | ^int matches any line that begins with int |
| $ (dollar sign) | Matches the end of a line. | done$ matches any line that ends with done |
| {} (curly braces) | Groups characters or expressions . | {a3}|{4b} matches a3 or 4b |
| [] (brackets) | Matches any one character or range listed within the brackets. | [a-z] matches every occurrence of lowercase letters [abc] matches every occurrence of a , b or c |
| ~ (tilde) | When appearing immediately after the left bracket, negates the contents of the set. | [~a-z] matches anything except lowercase letters [a-z~A-Z] matches all letters and the " ~ " character |
| \t (backslash t) | Matches any tab character. | \t3 matches every occurrence of a tab that a 3 follows |
| \x (backslash x) | Matches any character specified in hex. | \x2a matches every occurrence of the " * " character |
| \ (backslash) | Used if any of the above characters themselves are to be included in the search. | \-\?\\ matches every occurrence of " - " that " ? " and " \ " follow |