Skip to content

Commit

Permalink
Explain char in README
Browse files Browse the repository at this point in the history
  • Loading branch information
hlysine committed Aug 18, 2023
1 parent 6c89328 commit 1ef291a
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,17 +319,17 @@ uses the 2-byte sequence `\uffff`.

### Character Classes

| Function | RegExp equivalent | Explanation |
|---------------------------------------------------------------------------------------------------------------|-------------------|-------------------------------------------------------------------------------------------------|
| `word` | `\w` | Match alphanumeric characters and underscore |
| `not.word`<br/>`not(word)` | `\W` | Match anything other than `\w` |
| `digit` | `\d` | Match a character between `0` to `9` |
| `not.digit`<br/>`not(digit)` | `\D` | Match anything other than a digit |
| `whitespace` | `\s` | Match all types of whitespace characters |
| `not.whitespace`<br/>`not(whitespace)` | `\S` | Match anything other than a whitespace |
| `char` | `.` | `not.char` does not exist because it does not match anything |
| `` charIn`a-z_-` ``<br/>`charIn('a-z', '_-')`<br/>`` charIn`a-z` `_-` `` | `[a-z_-]` | Match a character listed in the group. A hyphen denotes a range of characters, such as `a-z`. † |
| `` notCharIn`a-z_-` ``<br/>`` not.charIn`a-z_-` ``<br/>`notCharIn('a-z', '_-')`<br/>`` notCharIn`a-z` `_-` `` | `[^a-z_-]` | Match a character not listed in the group. † |
| Function | RegExp equivalent | Explanation |
|---------------------------------------------------------------------------------------------------------------|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `word` | `\w` | Match alphanumeric characters and underscore |
| `not.word`<br/>`not(word)` | `\W` | Match anything other than `\w` |
| `digit` | `\d` | Match a character between `0` to `9` |
| `not.digit`<br/>`not(digit)` | `\D` | Match anything other than a digit |
| `whitespace` | `\s` | Match all types of whitespace characters |
| `not.whitespace`<br/>`not(whitespace)` | `\S` | Match anything other than a whitespace |
| `char` | `.` | Match any character other than newline (or including line terminators when single line flag is set)<br/>Note: `not.char` does not exist because it does not match anything |
| `` charIn`a-z_-` ``<br/>`charIn('a-z', '_-')`<br/>`` charIn`a-z` `_-` `` | `[a-z_-]` | Match a character listed in the group. A hyphen denotes a range of characters, such as `a-z`. † |
| `` notCharIn`a-z_-` ``<br/>`` not.charIn`a-z_-` ``<br/>`notCharIn('a-z', '_-')`<br/>`` notCharIn`a-z` `_-` `` | `[^a-z_-]` | Match a character not listed in the group. † |

#### † Notes on character classes

Expand Down

0 comments on commit 1ef291a

Please sign in to comment.