Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Quantifiers match an item a specified number of times.
|
Quantifier |
Meaning |
|---|---|
|
| |
|
| |
|
| |
|
|
Exactly
|
|
|
At least
|
|
|
Between
|
The * quantifier matches the
preceding character or group zero or more times. The following matches
cv.doc, along with any numbered
versions of the same file (e.g., cv2.doc, cv15.doc):
Console.Write (Regex.Match ("cv15.doc", @"cv\d*\.doc").Success); // True
Notice that we have to escape out the period in the file extension with a backslash.
The following allows anything between cv and .doc and is equivalent to dir cv*.doc:
Console.Write (Regex.Match ("cvjoint.doc", @"cv.*\.doc").Success); // True