Regular_Expressions
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| Regular_Expressions [2019/02/03 16:16] – [Software] ccstone | Regular_Expressions [2022/11/10 08:29] (current) – [Online Primers & Tutorials] ccstone | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | {{: | ||
| ====== Regular Expressions (RegEx) ====== | ====== Regular Expressions (RegEx) ====== | ||
| - | + | Keyboard Maestro uses [[https://www.keyboardmaestro.com/action/linkthru? | |
| - | Keyboard Maestro uses [[http://userguide.icu-project.org/strings/regexp|ICU Regular Expressions]] (aka RegEx or RegExp) which is very similar to PCRE (Perl Compatible Regular Expressions), | + | |
| Line 19: | Line 17: | ||
| ===== Search Modifiers ===== | ===== Search Modifiers ===== | ||
| - | The ICU calls these modifiers "[[http://userguide.icu-project.org/strings/regexp# | + | The ICU calls these modifiers "[[https://www.keyboardmaestro.com/action/linkthru? |
| The search modifier " | The search modifier " | ||
| Line 27: | Line 25: | ||
| ^Purpose^Pattern to Use^Description^ | ^Purpose^Pattern to Use^Description^ | ||
| - | |Global|NONE|All searches are global in Keyboard Maestro.\\ This is often indicated in other tools by the `/g` modifier.| | + | |Global|NONE|The [[action: |
| |Case Insensitive|`(? | |Case Insensitive|`(? | ||
| |Dot includes EOL|`(? | |Dot includes EOL|`(? | ||
| Line 39: | Line 37: | ||
| * Use the form of `$< | * Use the form of `$< | ||
| * Examples: | * Examples: | ||
| - | * `$1, $2, $3` | + | * `$1`, `$2`, `$23` |
| - | * `\1, \2, \3` | + | * `${1}`, ${2}`, ${23}`, |
| + | * `${name}` - named capture group (v9.2+, 10.13+) | ||
| + | * `\1`, `\2`, `\3` - single digit only (v8.0+) | ||
| * This is the same as `\< | * This is the same as `\< | ||
| + | * The zeroth capture group (eg `$0`) is the entire match. | ||
| For more information, | For more information, | ||
| Line 53: | Line 54: | ||
| ===== ICU 55+ Metacharacters ===== | ===== ICU 55+ Metacharacters ===== | ||
| - | For the currently complete list, see [ICU Regular Expression Metacharacters](http://userguide.icu-project.org/strings/regexp# | + | For the currently complete list, see [ICU Regular Expression Metacharacters](https://www.keyboardmaestro.com/action/linkthru? |
| - | + | ||
| - | **New Metacharacters Available in ICU 55+**(([ICU Regular Expression Metacharacters](http:// | + | |
| [ICU 55](http:// | [ICU 55](http:// | ||
| Line 63: | Line 62: | ||
| These Metacharacters offer some powerful solutions to long-standing RegEx problems. These can replace complicated RegEx patterns previously required, and are recommended for use if you are running the required versions. | These Metacharacters offer some powerful solutions to long-standing RegEx problems. These can replace complicated RegEx patterns previously required, and are recommended for use if you are running the required versions. | ||
| - | ^ New Metacharacters in ICU 55+(([ICU Regular Expression Metacharacters](http://userguide.icu-project.org/strings/regexp# | + | ^ New Metacharacters in ICU 55+(([ICU Regular Expression Metacharacters](https://www.keyboardmaestro.com/action/linkthru? |
| ^ Character ^ Alternate Expression\\ (Pre ICU 55) ^ Description ^ | ^ Character ^ Alternate Expression\\ (Pre ICU 55) ^ Description ^ | ||
| | `\h` | `[^\S\r\n\f]` | Match a Horizontal White Space character.\\ They are characters with Unicode General Category of Space_Separator plus the ASCII tab (\u0009). | | | `\h` | `[^\S\r\n\f]` | Match a Horizontal White Space character.\\ They are characters with Unicode General Category of Space_Separator plus the ASCII tab (\u0009). | | ||
| Line 132: | Line 131: | ||
| ==== General ==== | ==== General ==== | ||
| - | - [[http://userguide.icu-project.org/strings/regexp|ICU Regular Expressions]] | + | - [[https://www.keyboardmaestro.com/action/linkthru? |
| - [ICU Unicode Properties for Regular Expressions](http:// | - [ICU Unicode Properties for Regular Expressions](http:// | ||
| - [[https:// | - [[https:// | ||
| Line 164: | Line 163: | ||
| ==== Online Primers & Tutorials ==== | ==== Online Primers & Tutorials ==== | ||
| - | - [[http:// | ||
| - | - [[http:// | ||
| - [Regular Expressions Quick Start](http:// | - [Regular Expressions Quick Start](http:// | ||
| - [[http:// | - [[http:// | ||
| Keywords: | Keywords: | ||
Regular_Expressions.1549210618.txt.gz · Last modified: by ccstone
