User Tools

Site Tools


Regular_Expressions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
Regular_Expressions [2018/07/08 21:04]
JMichaelTX [ICU 55+ Metacharacters]
Regular_Expressions [2018/07/09 00:02]
peternlewis Keyboard Maestro version is irrelevent
Line 16: Line 16:
  
 There are many Actions in Keyboard Maestro where you can use a regular expression, which may not be obvious. ​ For more info see [Places where Regular Expressions can be used](https://​forum.keyboardmaestro.com/​t/​places-where-regular-expressions-can-be-used/​4392). There are many Actions in Keyboard Maestro where you can use a regular expression, which may not be obvious. ​ For more info see [Places where Regular Expressions can be used](https://​forum.keyboardmaestro.com/​t/​places-where-regular-expressions-can-be-used/​4392).
- 
- 
----- 
- 
  
 ===== Search Modifiers ===== ===== Search Modifiers =====
Line 40: Line 36:
  
 ===== Capture Groups ===== ===== Capture Groups =====
 +
   * Use the form of `$<​CG#>​`,​ or `\<​CG#>​` (in ver 8+) in the Action Replace box, where `<​CG#>​` is the number for the capture group. ​   * Use the form of `$<​CG#>​`,​ or `\<​CG#>​` (in ver 8+) in the Action Replace box, where `<​CG#>​` is the number for the capture group. ​
   * Examples: ​   * Examples: ​
Line 47: Line 44:
  
 For more information,​ see [[https://​www.regular-expressions.info/​brackets.html | Capture Groups]]. For more information,​ see [[https://​www.regular-expressions.info/​brackets.html | Capture Groups]].
- 
  
  
Line 54: Line 50:
 You can use Keyboard Maestro [[Tokens|Text Tokens]] anywhere appropriate in both the Search pattern and the Replace pattern. You can use Keyboard Maestro [[Tokens|Text Tokens]] anywhere appropriate in both the Search pattern and the Replace pattern.
  
---- 
  
 ===== ICU 55+ Metacharacters ===== ===== ICU 55+ Metacharacters =====
Line 64: Line 59:
 [ICU 55](http://​site.icu-project.org/​download/​55) was released on 2015-04-01, and is available in the follow software versions: [ICU 55](http://​site.icu-project.org/​download/​55) was released on 2015-04-01, and is available in the follow software versions:
   * macOS 10.11+ (El Capitan) except for JavaScript   * macOS 10.11+ (El Capitan) except for JavaScript
-  * Keyboard Maestro ​8.0+ Native Actions ​[FIXME: ​ Need to confirm KM version]+  * Keyboard Maestro Native Actions
  
 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. ​ For example, `\h` and `\R`.  ICU 55 is _not_ available in all RegEx engines. ​ A notable exception is JavaScript (and JXA), even in High Sierra. ​ So if you are using the native Keyboard Maestro Actions that use RegEx, it would be available, but not necessarily in Actions that use Execute Script in another language. ​ It is available in Execute AppleScript Actions that use ASObjC RegEx. 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. ​ For example, `\h` and `\R`.  ICU 55 is _not_ available in all RegEx engines. ​ A notable exception is JavaScript (and JXA), even in High Sierra. ​ So if you are using the native Keyboard Maestro Actions that use RegEx, it would be available, but not necessarily in Actions that use Execute Script in another language. ​ It is available in Execute AppleScript Actions that use ASObjC RegEx.
Line 79: Line 74:
 | `\V` | TBD | Match a non-new line character. | | `\V` | TBD | Match a non-new line character. |
 For an in-depth discussion, see this Forum topic: [RegEx for Horizontal Whitespace](https://​forum.keyboardmaestro.com/​t/​wiki-update-regex-icu-55-metacharacters/​10788). For an in-depth discussion, see this Forum topic: [RegEx for Horizontal Whitespace](https://​forum.keyboardmaestro.com/​t/​wiki-update-regex-icu-55-metacharacters/​10788).
---- 
  
 ===== Examples ===== ===== Examples =====
Line 103: Line 97:
  
 ===== See also: ===== ===== See also: =====
- 
----- 
  
 === Actions === === Actions ===
Line 125: Line 117:
 * [[:​Triggers|See all Triggers]] * [[:​Triggers|See all Triggers]]
  
----- 
  
 ==== Macros That Use RegEx ==== ==== Macros That Use RegEx ====
Line 174: Line 165:
   - [[http://​www.codeproject.com/​KB/​dotnet/​regextutorial.aspx|CodeProject.com RegExTutorial]]   - [[http://​www.codeproject.com/​KB/​dotnet/​regextutorial.aspx|CodeProject.com RegExTutorial]]
   - [[http://​regexr.com/​|Regexr ​ - Regex testing and explaining, examples and references]]   - [[http://​regexr.com/​|Regexr ​ - Regex testing and explaining, examples and references]]
- 
----- 
  
 Keywords: ​ //Regular Expression, RegEx, RegExp, Find, Replace, Match// Keywords: ​ //Regular Expression, RegEx, RegExp, Find, Replace, Match//
Regular_Expressions.txt ยท Last modified: 2022/11/10 03:29 by ccstone