mirror of
https://github.com/pi-hole/docs.git
synced 2025-12-20 03:08:45 +00:00
Merge pull request #1204 from pi-hole/tweak/regex_digit
Improve regex documentation
This commit is contained in:
@@ -89,20 +89,24 @@ Example | Interpretation
|
|||||||
|
|
||||||
In addition to character groups, there are also some special character classes available, such as
|
In addition to character groups, there are also some special character classes available, such as
|
||||||
|
|
||||||
Character class | Group equivalent | Pi-hole specific | Interpretation
|
Character class | Equivalent | Pi-hole specific | Interpretation
|
||||||
--------------- | ---------------- | ---------------- | ---------------
|
--------------- | ---------------- | ---------------- | ---------------
|
||||||
`[:digit:]` | `[0-9]` | No | matches digits
|
`[[:digit:]]` | `[0-9]` | No | digits
|
||||||
`[:lower:]` | `[a-z]` | No | matched lowercase letters(FTL matches case-insensitive by default)
|
`[[:lower:]]` | `[a-z]` | No | lowercase letters*
|
||||||
`[:upper:]` | `[A-Z]` | No | matched uppercase letters(FTL matches case-insensitive by default)
|
`[[:upper:]]` | `[A-Z]` | No | uppercase letters*
|
||||||
`[:alpha:]` | `[A-Za-z]` | No | matches alphabetic characters
|
`[[:alpha:]]` | `[A-Za-z]` | No | alphabetic characters*
|
||||||
`[:alnum:]` | `[A-Za-z0-9]` | No | matches alphabetic characters and digits
|
`[[:alnum:]]` | `[A-Za-z0-9]` | No | alphabetic characters* and digits
|
||||||
`[:blank:]` | `[ \t]` | Yes | blank characters
|
`[[:blank:]]` | `[ \t]` | Yes | blank characters
|
||||||
`[:cntrl:]` | N/A | Yes | control characters
|
`[[:cntrl:]]` | N/A | Yes | control characters
|
||||||
`[:graph:]` | N/A | Yes | all printable characters except space
|
`[[:graph:]]` | N/A | Yes | all printable characters except space
|
||||||
`[:print:]` | N/A | Yes | printable characters including space
|
`[[:print:]]` | N/A | Yes | printable characters including space
|
||||||
`[:punct:]` | N/A | Yes | printable characters not space or alphanumeric
|
`[[:punct:]]` | N/A | Yes | printable characters not space or alphanumeric
|
||||||
`[:space:]` | `[ \f\n\r\t\v]` | Yes | white-space characters
|
`[[:space:]]` | `[ \f\n\r\t\v]` | Yes | white-space characters
|
||||||
`[:xdigit:]` | `[0-9a-fA-F]` | Yes | hexadecimal digits
|
`[[:xdigit:]]` | `[0-9a-fA-F]` | Yes | hexadecimal digits
|
||||||
|
|
||||||
|
*) FTL matches case-insensitive by default as case does not matter in domain names
|
||||||
|
|
||||||
|
Note that character classes are abbreviations, they need to be used in character groups, i.e., enclosed in `[]`. As such, the equivalent of `[0-9]` would be `[[:digit:]]`, *not* `[:digit:]`. It is allowed to mix character classes with classical character groups. For example, `[a-z0-9]` is identical to `[a-z[:digit:]]`.
|
||||||
|
|
||||||
# Advanced examples
|
# Advanced examples
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user