RegEx – Regular Expressions
A regular expression is a pattern that is compared with the text to be examined and checked for matches. AllSync uses Microsoft VBScript Regular Expressions 5.5 as the interpreter for regular expressions.- Placeholders and control characters
- Regular sample expressions for individual characters
- Regular sample expressions for full expressions
- Helpful websites for using RegEx
Placeholders and control characters
| Expression | Syntax | Description |
|---|---|---|
| Line start | ^ | Starts the match at the beginning of the line. Only relevant at the beginning of an expression. |
| Or | | | Checks for a match before or after the '|' character. Mainly used in a group, e.g. "(Back)|(Foot)massage" matches "Back massage" and "Foot massage". |
| Line end | $ | Anchors the match at the end of the line. Only relevant at the end of an expression. |
| Character not in character set | [^] | Checks for any character not in the character set following '^'. |
| Marked expression | {} | Marks the matching text with the expression in parentheses. |
| Grouping | () | Groups a subexpression. |
| N-th marked text | \N | Checks for a match with the text corresponding to the N-th marked expression, where N is a number between 1 and 9. |
| Any character | . | Checks for a match with any single character. |
| One or more | + | Checks for at least one occurrence of the preceding expression. |
| Maximum of one or more | # | Checks for at least one occurrence of the preceding expression and matches as many characters as possible. |
| Escape | \ | Checks for a match with the character following the backslash (\). Allows you to match characters used in regular expression notation, such as '{' and '^'. |
| Repeat N times | ^N | Checks for N occurrences of the preceding expression. '[0-9]{4}' matches any four-digit sequence. |
| Character set | [] | Checks for a match with any character contained in square brackets []. To define a character range, list the start and end characters separated by a hyphen (-), e.g. [a-z]. |
| Alphanumeric character | :a | Checks for a match with the expression ([a-zA-Z0-9]). |
| Letter | :c | Checks for a match with the expression ([a-zA-Z]). |
| Decimal digit | :d | Checks for a match with the expression ([0-9]). |
| Hexadecimal number | :h | Checks for a match with the expression ([0-9a-fA-F]+). |
| Identifier | :I | Checks for a match with the expression ([a-zA-Z-$][a-zA-Z0-9_$]*). |
| Relational number | :n | Checks for a match with the expression (([0-9]+.[0-9]*)|([0-9]*.[0-9]+)|([0-9]+)). |
| Quoted string | :q | Checks for a match with the expression (("[~"]*")|('[~']*')). |
| Alphabetic string | :w | Checks for a match with the expression ([a-zA-Z]+). |
| Decimal integer | :z | Checks for a match with the expression ([0-9]+). |
| Tab character | \t | Checks for a match with a tab character, Unicode U+0009. |
| Unicode character | \x#### or \u#### | Checks for a match with a character given by its Unicode value, where #### is 1 to 4 hexadecimal digits. |
| Zero or more | * | Checks for zero or more occurrences of the preceding expression. |
| Maximum zero or more | @ | Checks for zero or more occurrences of the preceding expression and matches as many characters as possible. |
Regular sample expressions for individual characters
| Symbol | Example | Result | Usage |
|---|---|---|---|
| . | Ma.er | matches Maier, Majer, Mayer | Any character |
| [ ] | Ma[iy]er | matches Maier, Mayer | One of the characters in brackets |
| [ - ] | b[a-z]d | matches bad, bbd, bcd, bzd | A character in the specified range |
| [^ ] | Ma[^iy]er | matches Majer, but not Maier or Mayer | A character not listed in the brackets |
| \d | Backup \d | matches 'Backup 1', 'Backup 9' | A digit (matches [0-9]) |
| \D | Backup \D | matches 'Backup A', but not 'Backup 1' | Not a digit (matches [^0-9]) |
| \w | Backup \w | matches Backup 1, Backup A | Letter, digit, or underscore (matches [a-zA-Z0-9_]) |
| \W | abc\Wefg | matches 'abc efg', but not 'abcdefg' | Not a letter, digit, or underscore (matches [^a-zA-Z0-9_]) |
| \t | abc\txyz | matches 'abc' and tab and 'xyz' | Control character 'Tab' |
| \n | abc\nxyz | matches 'abc' and line break and 'xyz' | Control character for line break |
| \f | abc\fxyz | matches 'abc' and form feed and 'xyz' | Control character for form feed |
| \r | abc\rxyz | matches 'abc' and line feed and 'xyz' | Control character for line feed |
| \x | \x41BC | matches 'ABC' | 'x' is followed by the hexadecimal character value |
Regular sample expressions for full expressions
| Symbol | Example | Result | Usage |
|---|---|---|---|
| ^ | ^Backup | matches 'Backup' at the beginning | marks the start of the string |
| $ | Backup$ | matches 'Backup' at the end | marks the end of the string |
| \b | ung\b | matches 'ung' at the end of a word | denotes a word boundary (between \\w and \\W) |
| \B | \Baus | matches 'Haus' or 'Maus', but not 'aus' | denotes anything except a word boundary |





