License:
Version:
Authors:
| X|Y | alternation, i.e. X or Y |
| (X) | matching brackets - creates a sub-match |
| (?X) | non-matching brackets - only groups X, no sub-match is created |
| [Z] | character class specification, Z is a string of characters or character ranges, e.g. [a-zA-Z0-9_.\-] |
| [^Z] | negated character class specification |
| <X | lookbehind, X may be a single character or a character class |
| >X | lookahead, X may be a single character or a character class |
| ^ | start of input or start of line |
| $ | end of input or end of line |
| \b | start or end of word, equals (?<\s>\S|<\S>\s) |
| \B | opposite of \b, equals (?<\S>\S|<\s>\s) |
| X? | zero or one |
| X* | zero or more |
| X+ | one or more |
| X{n,m} | at least n, at most m instances of X. If n is missing, it's set to 0. If m is missing, it is set to infinity. |
| X?? | non-greedy version of the above operators |
| X*? | see above |
| X+? | see above |
| X{n,m}? | see above |
| . | any printable character |
| \s | whitespace |
| \S | non-whitespace |
| \w | alpha-numeric characters or underscore |
| \W | opposite of \w |
| \d | digits |
| \D | non-digit |
Parameters:
| pattern | Regular expression. |
Throws:
Example:
Parameters:
| pattern | Regular expression. |
Throws:
Example:
Returns:
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 | import tango.io.Stdout; import tango.text.Regex; void main() { foreach(m; Regex("ab").search("qwerabcabcababqwer")) Stdout.formatln("{}[{}]{}", m.pre, m.match(0), m.post); } // Prints: // qwer[ab]cabcababqwer // qwerabc[ab]cababqwer // qwerabcabc[ab]abqwer // qwerabcabcab[ab]qwer |
Returns:
Returns:
Parameters:
| index | 0 returns whole match, index > 0 returns submatch of bracket #index |
Returns:
Example: