pattern | description |
---|---|
. | any character except a newline |
^ | start of the string |
$ | end of the string |
* | match 0 or more repetitions of the preceding RE. greedy. |
+ | match 1 or more repetitions of the preceding RE. greedy. |
? | match 0 or 1 repetitions of the preceding RE. greedy. |
*? | non-greedy version of * |
+? | non-greedy version of + |
?? | non-greedy version of ? |
{m} | exactly m copies of the previous RE |
{m,n} | match from m to n repetitions of the precedingRE |
{m,n}? | non-greedy version of {m ,n} |
\ | escapes special characters |
[] | indicate a set of characters |
| | match either A or B, where A and B can be arbitrary REs |
greedy
: they match as much text as possiblenon-greedy
: minimal fashion; as few characters as possible will be matched