Mikroelektronika MIKROE-742 데이터 시트
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.unicode.org/unicode/reports/tr18/
http://www.unicode.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 alphanumeric char-
acter (
"\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
matching a
"
\W"
.
\b
- match a word boundary)
\B
- match a non-(word boundary)
69
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Environment
mikroPASCAL PRO for AVR
CHAPTER 2