Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| docs:8000_appendices:0500_regular_expressions [2022/08/18 12:28] – removed - external edit (Unknown date) 127.0.0.1 | docs:8000_appendices:0500_regular_expressions [2022/09/13 18:15] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Appendix E. Regular Expressions. ====== | ||
| + | |||
| + | === Summary of regular-expression constructs === | ||
| + | |||
| + | ^Construct^Matches^ | ||
| + | ^ Characters | ||
| + | |X|The character x| | ||
| + | |\\|The backslash character| | ||
| + | |\0n|The character with octal value 0n < | ||
| + | |\0nn|The character with octal value 0nn < | ||
| + | |\0mnn|The character with octal value 0mnn < | ||
| + | |\xhh|The character with hexadecimal value 0xhh| | ||
| + | |\uhhhh|The character with hexadecimal value 0xhhhh| | ||
| + | |\t|The tab character (' | ||
| + | |\n|The newline (line feed) character (' | ||
| + | |\r|The carriage-return character (' | ||
| + | |\f|The form-feed character (' | ||
| + | |\a|The alert (bell) character (' | ||
| + | |\e|The escape character (' | ||
| + | |\cx|The control character corresponding to x| | ||
| + | ^ Character classes | ||
| + | |[abc]|a, b, or c (simple class)| | ||
| + | |[abc]|Any character except a, b, or c (negation)| | ||
| + | |[a-zA-Z]|a through z or A through Z, inclusive (range)| | ||
| + | |[a-d[m-p]]|a through d, or m through p: [a-dm-p] (union)| | ||
| + | |[a-z&& | ||
| + | |< | ||
| + | |< | ||
| + | ^ Predefined character classes | ||
| + | |.|Any character (may or may not match [[http:// | ||
| + | |\d|A digit: [0-9]| | ||
| + | |\D|A non-digit: < | ||
| + | |\s|A whitespace character: [ \t\n\x0B\f\r]| | ||
| + | |\S|A non-whitespace character: < | ||
| + | |\w|A word character: [a-zA-Z_0-9]| | ||
| + | |\W|A non-word character: < | ||
| + | ^ POSIX character classes (US-ASCII only) ^^ | ||
| + | |\p{Lower}|A lower-case alphabetic character: [a-z]| | ||
| + | |\p{Upper}|An upper-case alphabetic character: | ||
| + | |\p{ASCII}|All ASCII: | ||
| + | |\p{Alpha}|An alphabetic character: | ||
| + | |\p{Digit}|A decimal digit: [0-9]| | ||
| + | |\p{Alnum}|An alphanumeric character: | ||
| + | |\p{Punct}|Punctuation: | ||
| + | |\p{Graph}|A visible character: [\p{Alnum}\p{Punct}]| | ||
| + | |\p{Print}|A printable character: [\p{Graph}]| | ||
| + | |\p{Blank}|A space or a tab: [ \t]| | ||
| + | |\p{Cntrl}|A control character: [\x00-\x1F\x7F]| | ||
| + | |\p{XDigit}|A hexadecimal digit: [0-9a-fA-F]| | ||
| + | |\p{Space}|A whitespace character: [ \t\n\x0B\f\r]| | ||
| + | ^ Classes for Unicode blocks and categories | ||
| + | | \p{InGreek}|A character in the Greek block (simple [[http:// | ||
| + | | \p{Lu}|An uppercase letter (simple [[http:// | ||
| + | | \p{Sc}|A currency symbol| | ||
| + | | \P{InGreek}|Any character except one in the Greek block (negation)| | ||
| + | |< | ||
| + | ^ Boundary matchers | ||
| + | |< | ||
| + | |$|The end of a line| | ||
| + | |\b|A word boundary| | ||
| + | |\B|A non-word boundary| | ||
| + | |\A|The beginning of the input| | ||
| + | |\G|The end of the previous match| | ||
| + | |\Z|The end of the input but for the final [[http:// | ||
| + | |\z|The end of the input| | ||
| + | ^ Greedy quantifiers | ||
| + | |X?|X, once or not at all| | ||
| + | |X*|X, zero or more times| | ||
| + | |X+|X, one or more times| | ||
| + | |X{n}|X, exactly n times| | ||
| + | |X{n,}|X, at least n times| | ||
| + | |X{n,m}|X, at least n but not more than m times| | ||
| + | ^ Reluctant quantifiers | ||
| + | |X??|X, once or not at all| | ||
| + | |X*?|X, zero or more times| | ||
| + | |X+?|X, one or more times| | ||
| + | |X{n}?|X, exactly n times| | ||
| + | |X{n,}?|X, at least n times| | ||
| + | |X{n,m}?|X, at least n but not more than m times| | ||
| + | ^ Possessive quantifiers | ||
| + | |X?+|X, once or not at all| | ||
| + | |X*+|X, zero or more times| | ||
| + | |X++|X, one or more times| | ||
| + | |X{n}+|X, exactly n times| | ||
| + | |X{n,}+|X, at least n times| | ||
| + | |X{n,m}+|X, at least n but not more than m times| | ||
| + | ^ Logical operators | ||
| + | |XY|X followed by Y| | ||
| + | |< | ||
| + | |(X)|X, as a [[http:// | ||
| + | ^ Back references | ||
| + | |\n|Whatever the n< | ||
| + | ^ Quotation | ||
| + | |\|Nothing, but quotes the following character| | ||
| + | |\Q|Nothing, | ||
| + | |\E|Nothing, | ||
| + | ^ Special constructs (non-capturing) | ||
| + | |(?:X)|X, as a non-capturing group| | ||
| + | |(? | ||
| + | |(? | ||
| + | |(?=X)|X, via zero-width positive lookahead| | ||
| + | |(?!X)|X, via zero-width negative lookahead| | ||
| + | |< | ||
| + | |(?< | ||
| + | |(?> | ||
| + | |||
| + | |||
| + | |||