
Hitachi Embedded Workshop User Manual
331
Appendix B: Regular Expressions
The Hitachi Embedded Workshop editor allows you to include special characters in search strings when
performing a find or replace operation. These characters are listed in table B.1 and are detailed in the following
pages.
Table B.1: Regular Expression Characters
Character
Function
?
Matches any single character (except newline)
*
Matches any number of occurrences (0 or more) of any character except a
newline
\n
Matches a new line character
\t
Matches a tab character
[ ]
Matches any one character or range listed within the brackets
\
Overrides any following regular expression character
Symbol:
?
Meaning:
This character matches any single character, except the newline character.
Example:
t?p matches “top”, “tip” but not “trap”.
Symbol:
*
Meaning:
This character matches any number of occurrences (0 or more) of any character except a
newline. Thus, this character will not match across new lines. The * character will match as few
occurrences as are necessary to make the rest of the pattern match.
Example 1: t*o matches the “to” of “too”, the “tro” of “trowel” and the “ty o” of
“sporty orange” but not “smart
orange” because the * character does not match across a new line.
Symbol:
\n
Meaning:
This character matches the newline character.
\n would be used to search for line endings or in patterns that cross line boundaries.
Example 1: ;\n
matches every occurrence of a newline following a semicolon
Example 2: ;\nif
searches for a semicolon, a new line and a line beginning with “if”.