The editor can search and replace test using regular expressions. A regular expression is a string that uses special characters to describe and reference patterns of text. The regular expression system used by the editor is modelled on Perl's regexp language. For more information on regular expressions, see Mastering Regular Expressions, Jeffrey E F Freidl, ISBN 0596002890.

## Summary of special characters

The following table summarizes the special characters that the CrossStudio editor supports.

Characters | Meaning
\d | Match a numeric character.
\D | Match a non-numeric character.
\s | Match a whitespace character.
\S | Match a non-whitespace character.
\w | Match a word character.
\W | Match a non-word character.
[c] | Match set of characters, e.g. [ch] matches characters c or h. A range can be specified using the '-' character, e.g. [0-27-9] matches if character is 0, 1, 2, 7 8 or 9. A range can be negated using the '^' character, e.g. [^a-z] matches if character is anything other than a lower case alphabetic character.
\c | The literal character c. For example to match the character * you would use \*.
\a | Match ASCII bell character.
\f | Match ASCII form feed character.
\n | Match ASCII line feed character.
\r | Match ASCII carriage return character.
\t | Match ASCII horizontal tab character.
\v | Match ASCII vertical tab character.
\xhhhh | Match Unicode character specified by hexadecimal number hhhh.
. | Match any character.
* | Match zero or more occurrences of the preceding expression.
+ | Match one or more occurrences of the preceding expression.
? | Match zero or one occurrences of the preceding expression.
{n} | Match n occurrences of the preceding expression.
{n,} | Match at least n occurrences of the preceding expression.
{,m} | Match at most m occurrences of the preceding expression.
{n,m} | Match at least n and at most m occurrences of the preceding expression.
^ | Beginning of line.
$ | End of line.
\b | Word boundary.
\B | Non-word boundary.
(e) | Capture expression e.
\n | Backreference to nth captured text.

## Examples

The following regular expressions can be used with the editor's search and replace operations. To use the regular expression mode the Use regular expression check box must be set in the search and replace dialog. Once enabled, the regular expressions can be used in the Find what search string. The Replace with strings can use the "\n" backreference string to reference any captured strings.

"Find what" String | "Replace with" String | Description
`u\w.d` |  | Search for any length string containing one or more word characters beginning with the character ‘u’ and ending in the character ‘d’.
`^.*;$` |  | Search for any lines ending in a semicolon.
`(typedef.+\s+)(\S+);` | `\1TEST_\2;` | Find C type definition and insert the string “TEST” onto the beginning of the type name.