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​

ConstructDescriptionExample
.Matches any single character except line breaksa.b matches acb, axb
^Matches the beginning of a string^abc matches abc only at the start
$Matches the end of a stringabc$ matches abc only at the end
*Matches zero or more occurrences of the preceding unitab*c matches ac, abc, abbc
+Matches one or more occurrences of the preceding unitab+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 literallya\+b matches a+b

Working Examples​

PatternInputMatch?Explanation
a.bacbyes. matches any character between a and b
ab*abbbyes* matches zero or more b
ab+acno+ requires at least one b
[a-z]+abcyesMatches one or more lowercase letters
[^0-9]abc123yesMatches all non-digits at the start
{ab}*cabababcyesMatches zero or more ab sequences followed by c
^abc$abcyesMatches abc only if it is the entire input
a\+ba+byesMatches literal plus sign using backslash escape
a *:=a :=yesMatches 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.
  • Like
Reactions: Osvaldo Ramirez