Overview
This document serves as a cheat sheet for the syntax of the regular expressions that are supported in the Xbase++ Workbench "Find Text" dialog.
By checking the item "Regular expressions" the dialog allows users to define simple regular expressions for searching in the current file or in multiple files. The regular expression engine is not POSIX or PCRE compliant, but supports simple constructs suitable for typical text and code searches.
Supported Constructs
| Construct | Description | Example |
| . | Matches any single character except line breaks | a.b matches acb, axb |
| ^ | Matches the beginning of a string | ^abc matches abc only at the start |
| $ | Matches the end of a string | abc$ matches abc only at the end |
| * | Matches zero or more occurrences of the preceding unit | ab*c matches ac, abc, abbc |
| + | Matches one or more occurrences of the preceding unit | ab+c matches abc, abbc |
| [...] | Character class with optional negation and ranges | [a-z], [^0-9] |
| {...} | Groups multiple characters as a unit | {ab}* matches, ab, abab |
| \ | Escapes a special character to match it literally | a\+b matches a+b |
Working Examples
| Pattern | Input | Match? | Explanation |
| a.b | acb | yes | . matches any character between a and b |
| ab* | abbb | yes | * matches zero or more b |
| ab+ | ac | no | + requires at least one b |
| [a-z]+ | abc | yes | Matches one or more lowercase letters |
| [^0-9] | abc123 | yes | Matches all non-digits at the start |
| {ab}*c | abababc | yes | Matches zero or more ab sequences followed by c |
| ^abc$ | abc | yes | Matches abc only if it is the entire input |
| a\+b | a+b | yes | Matches literal plus sign using backslash escape |
| a *:= | a := | yes | Matches a followed by arbitrary spaces and := |
Notes
- Grouping using {} allows treating a block of characters as a unit for repetition.
- Escaping with \ is necessary for symbols like +, *, . when they should be matched literally.
- Use character classes such as [ \t] to explicitly match spaces or tabs if needed.