This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
Regular_Expressions [2020/09/26 23:53] JMichaelTX [Search Modifiers] fix link |
Regular_Expressions [2021/04/08 00:16] peternlewis [Capture Groups] |
||
---|---|---|---|
Line 39: | Line 39: | ||
* 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: | ||
- | * `$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 `\<CG#>` used in other apps/languages, like BBEdit. | * This is the same as `\<CG#>` used in other apps/languages, like BBEdit. | ||
+ | * The zeroth capture group (eg `$0`) is the entire match. | ||
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]]. |