Template:LSL Regular Expressions: Difference between revisions
Jump to navigation
Jump to search
Rider Linden (talk | contribs) No edit summary |
Rider Linden (talk | contribs) No edit summary |
||
| Line 100: | Line 100: | ||
\D | \D | ||
| Any decimal digit. | | Any decimal digit. | ||
| '''\d''' | | | ||
* '''\d''' → <nowiki>[[</nowiki>:digit:]] or [0-9] | |||
'''\D''' | * '''\D''' → <nowiki>[^[</nowiki>:digit:]] or [^0-9] | ||
|- | |- | ||
! \l | ! \l | ||
| Line 108: | Line 108: | ||
\L | \L | ||
| Any lower case character. | | Any lower case character. | ||
| '''\l''' | | | ||
* '''\l''' → <nowiki>[[</nowiki>:lower:]] or [a-z] | |||
'''\L''' | * '''\L''' → <nowiki>[^[</nowiki>:lower:]] or [^a-z] | ||
|- | |- | ||
! \s | ! \s | ||
| Line 116: | Line 116: | ||
\S | \S | ||
| Any whitespace character. | | Any whitespace character. | ||
| '''\s''' | | | ||
* '''\s''' → <nowiki>[[</nowiki>:space:]] or [ \t\r\n] | |||
'''\S''' | * '''\S''' → <nowiki>[^[</nowiki>:space:]] or [^ \t\r\n] | ||
|- | |- | ||
! \u | ! \u | ||
| Line 124: | Line 124: | ||
\U | \U | ||
| Any upper case character. | | Any upper case character. | ||
| '''\u''' | | | ||
* '''\u''' → <nowiki>[[</nowiki>:upper:]] or [A-Z] | |||
'''\U''' | * '''\U''' → <nowiki>[^[</nowiki>:upper:]] or [^A-Z] | ||
|- | |- | ||
! \w | ! \w | ||
| Line 134: | Line 134: | ||
Alphanumeric plus underscore | Alphanumeric plus underscore | ||
| '''\w''' | | | ||
* '''\w''' → <nowiki>[[</nowiki>:upper:][:lower:][:digit:]_] or [A-Za-z0-9_] | |||
'''\W''' | * '''\W''' → <nowiki>[^[</nowiki>:upper:][:lower:][:digit:]_] or [^A-Za-z0-9_] | ||
|- | |- | ||
| | | | ||
Revision as of 14:21, 19 October 2022
| Wildcard | ||
|---|---|---|
| . | Matches any character | |
| Anchors | ||
| ^ | Matches the beginning of the string. | |
| $ | Matches the end of the string. | |
| Repeats | ||
| * | Matches the preceding atom 0 or more times. | |
| + | Matches the preceding atom 1 or more times. | |
| ? | Matches the preceding atom 0 or 1 times. | |
| {n}
{n,} {n, m} |
Matches the preceding atom n, n or more, or between n and m times. | |
| Sub-expressions | ||
| (expression) | Text enclosed in parentheses is a marked sub-expression. Text matched as part of a sub-expressions is split out and may be repeated. | |
| Alternation | ||
| a | b | Match either a or b. | |
| Character Sets | ||
| [abc] | Matches any one of the enumerated characters. | |
| [a-c] | Matches any character in the specified range. | |
| [^abc] | Matches any character other than the enumerated characters. | |
| [[:name:]] | Matches any character of the named class. | |
| Any of the above character set definitions may be combined. | ||
| Escape Sequences | ||
| Specific Characters | ||
| \e | ASCII 0x1B, ESC | |
| \n | New line | |
| \r | Carriage return | |
| \t | Tab | |
| \xdd | Matches an ASCII character with the code dd | |
| Single character classes | ||
| \d
\D |
Any decimal digit. |
|
| \l
\L |
Any lower case character. |
|
| \s
\S |
Any whitespace character. |
|
| \u
\U |
Any upper case character. |
|
| \w
\W |
Any "word" character.
Alphanumeric plus underscore |
|
| Word boundaries | ||
| \< | Start of word. | |
| \> | End of word | |
| \b | ||
| \B | Not a word boundary. | |
| Named Character Classes | ||
| alnum | Any alpha-numeric character. |
|
| alpha | Any alphabetic character. |
|
| blank | Any whitespace character that is not a line separator. | |
| cntrl | Any control character |
|
| digit
d |
Any decimal digit |
|
| lower
l |
Any lower case character. |
|
| Any printable character. | ||
| punct | Any punctiation character. | |
| space
s |
Any whitespace character. | |
| upper
u |
Any upper case character. |
|
| word
w |
Any control character |
|
| xdigit
w |
Any hexadecimal digit character |
|