regexp: Update formatting

This commit is contained in:
Rico Sta. Cruz 2019-03-24 07:38:52 +08:00
parent aaa1f64e65
commit f79ab86a2c
No known key found for this signature in database
GPG Key ID: CAAD38AE2962619A
1 changed files with 38 additions and 33 deletions

View File

@ -5,15 +5,19 @@ layout: 2017/sheet
weight: -1 weight: -1
authors: authors:
- github: rizqyhi - github: rizqyhi
updated: 2018-10-26 updated: 2019-03-24
description: | description: |
Basic cheatsheets for regular expression Basic cheatsheets for regular expression
--- ---
### Character Classes ##
{: .-three-column}
### Character classes
| Pattern | Description | | Pattern | Description |
| --- | --- | | ------- | ------------------------------ |
| `.` | Any character, except newline | | `.` | Any character, except newline |
| `\w` | Word | | `\w` | Word |
| `\d` | Digit | | `\d` | Digit |
@ -28,14 +32,14 @@ description: |
### Anchors ### Anchors
| Pattern | Description | | Pattern | Description |
| --- | --- | | ------- | ---------------- |
| `^abc` | Start with `abc` | | `^abc` | Start with `abc` |
| `abc$` | End with `abc` | | `abc$` | End with `abc` |
### Escaped Characters ### Escaped characters
| Pattern | Description | | Pattern | Description |
| --- | --- | | ---------- | -------------------------------------- |
| `\. \* \\` | Escape special character used by regex | | `\. \* \\` | Escape special character used by regex |
| `\t` | Tab | | `\t` | Tab |
| `\n` | Newline | | `\n` | Newline |
@ -44,13 +48,13 @@ description: |
### Groups ### Groups
| Pattern | Description | | Pattern | Description |
| --- | --- | | ------- | ------------- |
| `(abc)` | Capture group | | `(abc)` | Capture group |
### Quantifiers ### Quantifiers
| Pattern | Description | | Pattern | Description |
| --- | --- | | -------- | --------------------- |
| `a*` | Match 0 or more | | `a*` | Match 0 or more |
| `a+` | Match 1 or more | | `a+` | Match 1 or more |
| `a?` | Match 0 or 1 | | `a?` | Match 0 or 1 |
@ -58,3 +62,4 @@ description: |
| `a{,3}` | Match up to 3 | | `a{,3}` | Match up to 3 |
| `a{3,}` | Match 3 or more | | `a{3,}` | Match 3 or more |
| `a{1,3}` | Match between 1 and 3 | | `a{1,3}` | Match between 1 and 3 |