Mikroelektronika MIKROE-742 데이터 시트
Character classes
You can specify a character class, by enclosing a list of characters in
[]
, which will
match any of the characters from the list. If the first character after the
"["
is
"^"
,
the class matches any character not in the list.
Examples:
count[aeiou]r
finds strings
'countar', 'counter'
, etc. but not
'
countbr',
'
countcr'
, etc.
count[^aeiou]r
finds strings
'
countbr', 'countcr'
, etc. but not
'
countar'
,
'
counter'
, etc.
Within a list, the
"-"
character is used to specify a range, so that
a-z
represents all
characters between
"
a"
and
"
z"
, inclusive.
If you want
"-"
itself to be a member of a class, put it at the start or end of the list,
or precede it with a backslash.
If you want
If you want
'
]'
, you may place it at the start of list or precede it with a backslash.
Examples:
[-az]
matches
'
a', 'z'
and
'-'
[az-]
matches
'
a', 'z'
and
'-'
[a\-z]
matches
'
a', 'z'
and
'-'
[a-z]
matches all twenty six small characters from
'
a'
to
'
z'
[\n-\x0D]
matches any of
#10,#11,#12,#13
.
[\d-t]
matches any digit,
'-'
or
'
t'
.
[]-a]
matches any char from
'
]'..'a'
.
Metacharacters
Metacharacters are special characters which are the essence of regular expres-
sions. There are different types of metacharacters, described below.
sions. There are different types of metacharacters, described below.
Metacharacters - Line separators
^
- start of line
$
- end of line
\A
- start of text
\Z
- end of text
.
- any character in line
68
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Environment
mikroPASCAL PRO for AVR
CHAPTER 2