Regular expressions
Javascript form to interactively test regular expressions agains multiple text fragments.
Basic regular expression elements:
Literals | |
a B G 7 0 @ - = % | letters and digits match exactly |
\. \\ \$ \[ | escaped special characters |
\n \r \t \dec_code \xhex_code | non printable characters |
Anchors | |
^ $ | begin/end of line |
\b | word boundary |
\B | not a word boundary |
Character groups | |
. | any char except newline |
\d \D \s \S \w | decimal digit, non digit, whitespace, not whitespace, char from [a-zA-Z0-9_] |
[char_list] | any char from list, i.e. [0123456789], [a-zA-Z0-9_] |
[^char_list] | any char outside list, i.e. [^0-9] |
Counts - add ? for non-greedy. | |
expr* | 0 or more |
expr? | 0 or 1 |
expr+ | 1 or more |
expr{n,m} | n to m |
expr{n} | exactly n |
expr{n,} | n or more |
Alternation: expr1|expr2 |