Added match a single character that is not contained within the brackets. For example, [^abc]

Matches a single character that is not contained within the brackets. For example, [^abc] matches any character other than "a", "b", or "c". [^a-z] matches any single character that is not a lowercase letter from "a" to "z". Likewise, literal characters and ranges can be mixed.
This commit is contained in:
Martin Stühmer 2019-11-14 16:56:16 +01:00 committed by Rico Sta. Cruz
parent 5735718b7b
commit 1a17fe6148
1 changed files with 15 additions and 13 deletions

View File

@ -5,7 +5,8 @@ layout: 2017/sheet
weight: -1 weight: -1
authors: authors:
- github: rizqyhi - github: rizqyhi
updated: 2019-03-24 - github: samtrion
updated: 2019-11-14
description: | description: |
Basic cheatsheets for regular expression Basic cheatsheets for regular expression
--- ---
@ -16,18 +17,19 @@ description: |
### Character classes ### Character classes
| Pattern | Description | | Pattern | Description |
| ------- | ------------------------------ | | -------- | ------------------------------- |
| `.` | Any character, except newline | | `.` | Any character, except newline |
| `\w` | Word | | `\w` | Word |
| `\d` | Digit | | `\d` | Digit |
| `\s` | Whitespace | | `\s` | Whitespace |
| `\W` | Not word | | `\W` | Not word |
| `\D` | Not digit | | `\D` | Not digit |
| `\S` | Not whitespace | | `\S` | Not whitespace |
| `[abc]` | Any of a, b, or c | | `[abc]` | Any of a, b, or c |
| `[a-e]` | Characters between `a` and `e` | | `[a-e]` | Characters between `a` and `e` |
| `[1-9]` | Digit between `1` and `9` | | `[1-9]` | Digit between `1` and `9` |
| `[^abc]` | Any character except a, b and c |
### Anchors ### Anchors