Mikroelektronika MIKROE-350 データシート
Examples:
^PORTA
- matches string '
PORTA
' only if it's at the beginning of line
PORTA$
- matches string '
PORTA
' only if it's at the end of line
^PORTA$
- matches string '
PORTA
' only if it's the only string in line
PORT.r
- matches strings like '
PORTA
', '
PORTB
', '
PORT1
' and so on
The
"^"
metacharacter by default is only guaranteed to match beginning of the input
string/text, and the
"$"
metacharacter only at the end. Embedded line separators
will not be matched by
^"
or
"$"
.
You may, however, wish to treat a string as a multi-line buffer, such that the
"^"
will
match after any line separator within the string, and
"$"
will match before any line
separator.
Regular expressions works with line separators as recommended at http://www.uni-
code.org/unicode/reports/tr18/
Regular expressions works with line separators as recommended at http://www.uni-
code.org/unicode/reports/tr18/
Metacharacters - Predefined classes
\w
- an alphanumeric character (including "_")
\W
- a nonalphanumeric character
\d
- a numeric character
\D
- a non-numeric character
\s
- any space (same as
[\t\n\r\f]
)
\S
- a non space
You may use
\w, \d
and
\s
within custom character classes.
Example:
routi\de
- matches strings like '
routi1e
', '
routi6e
' and so on, but not
'
routine
', '
routime
' and so on.
Metacharacters - Word boundaries
A word boundary (
"\b"
) is a spot between two characters that has an alphanumer-
ic character (
"\w"
) on one side, and a nonalphanumeric character (
"\W"
) on the
other side (in either order), counting the imaginary characters off the beginning and
end of the string as matching a
end of the string as matching a
"\W"
.
\b
- match a word boundary)
\B
- match a non-(word boundary)
64
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Environment
mikroBasic PRO for AVR
CHAPTER 2