Datasheet
Metacharacters - Word boundaries
A word boundary ("\b") is a spot between two characters that has a "\w" on one
side of it and a
"\W" on the other side of it (in either order), counting the imaginary
characters off the beginning and end of the string as matching a
"\W".
\b - match a word boundary)
\B - match a non-(word boundary)
Metacharacters - Iterators
Any item of a regular expression may be followed by another type of metacharac-
ters - iterators. Using this metacharacters,you can specify number of occurences of
previous character, metacharacter or subexpression.
* - zero or more ("greedy"), similar to {0,}
+ - one or more ("greedy"), similar to {1,}
? - zero or one ("greedy"), similar to {0,1}
{n} - exactly n times ("greedy")
{n,} - at least n times ("greedy")
{n,m} - at least n but not more than m times ("greedy")
*? - zero or more ("non-greedy"), similar to {0,}?
+? - one or more ("non-greedy"), similar to {1,}?
?? - zero or one ("non-greedy"), similar to {0,1}?
{n}? - exactly n times ("non-greedy")
{n,}? - at least n times ("non-greedy")
{n,m}? - at least n but not more than m times ("non-greedy")
So, digits in curly brackets of the form, {n,m}, specify the minimum number of times to
match the item n and the maximum m. The form {n} is equivalent to {n,n} and match-
es exactly n times. The form {n,} matches n or more times. There is no limit to the
size of n or m, but large numbers will chew up more memory and slow down execution.
If a curly bracket occurs in any other context, it is treated as a regular character.
Examples:
count.*r ß- matches strings like 'counter', 'countelkjdflkj9r' and
'countr'
count.+r
- matches strings like 'counter', 'countelkjdflkj9r' but not
'countr'
count.?r
- matches strings like 'counter', 'countar' and 'countr' but
not 'countelkj9r'
72
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Environment
mikroC PRO for AVR
CHAPTER 2