Anchoring Metacharacters
Metacharacter | Description |
^ | Anchor the expression to the start of a line |
$ | Anchor the expression to the end of a line |
Quantifiers, or Repetition Operators
Quantifier | Description |
* | Match 0 or more times |
? | Match 0 or 1 time |
+ | Match 1 or more times |
{m} | Match exactly m times |
{m,} | Match at least m times |
{m, n} | Match at least m times but no more than n times |
Predefined POSIX Character Classes
Character Class | Description |
[:alpha:] | Alphabetic characters |
[:lower:] | Lowercase alphabetic characters |
[:upper:] | Uppercase alphabetic characters |
[:digit:] | Numeric digits |
[:alnum:] | Alphanumeric characters |
[:space:] | Space characters (nonprinting), such as carriage return, newline, vertical tab, and form feed |
[:punct:] | Punctuation characters |
[:cntrl:] | Control characters (nonprinting) |
[:print:] | Printable characters |
Alternate Matching and Grouping of Expressions
Metacharacter | Description | |
| | Alternation | Separates alternates, often used with grouping operator () |
( ) | Group | Groups subexpression into a unit for alternations, for quantifiers, or for backreferencing |
[char] | Character list | Indicates a character list; most metacharacters inside a character list are understood as literals, with the exception of character classes, and the ^ and - metacharacters |
Great Job.
ReplyDelete