Live template | template | Supplier LiveTemplate|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Table of Contents | ||||||||||||
|
Overview
This provides access to match values using regular expressions.
Typically, instances of 'Matcher' will be accessed via the 'match' and 'find' keys of the Text Supplier.
Details
Name: | Match Supplier | ||||||
---|---|---|---|---|---|---|---|
Prefix: | match(optional) | ||||||
Supported Content: | Matchers | ||||||
Provided By: |
|
Supported Keys
List of keys that this supplier returns a value for.
Key | Content Types | Return Type | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
[default]/value | Match | The full matched value, from 'start' to 'end'. | |||||||
start | Match | The zero-based index the pattern started matching on. | |||||||
end | Match | The zero-based index the pattern ended matching on. | |||||||
groups | Match | The list of capturing groups in the current match.
| |||||||
group count | Match | The number of groups in the current match. | |||||||
group [X] | Match | The capturing group at the specified index.
You can request group 0, but it will be equivalent to the 'value' key above. | |||||||
pattern | Match | The regular expression pattern used by this matcher. This only works with results from Text Supplier 'match' key, not the 'find' key. | |||||||
replace with [X] | Match | Replaces the matched pattern with 'X'. You can use '$' with a group number to keep a captured group from the pattern
| |||||||
replace all with [X] | Match | Replaces all occurrences of the pattern with 'X'.
You can use '$' with a group number to keep a captured group from the pattern. Eg. 'replace with The $1 value'. This only works reliably with results from Text Supplier 'match' key, not the 'find' key. | |||||||
replace first with [X] | Match | Replaces the first occurrence of the pattern with 'X'.
You can use '$' with a group number to keep a captured group from the pattern
This only works reliably with results from Text Supplier 'match' key, not the 'find' key. |
Examples
Replace All
Replaces all occurrences of "," with "-".
{report-info:data:Text > text:match "," > match:replace all with "-"}
Replace Space
Replaces the first space " " with a ":". {report-info:data:Text > text:match "[ ]" > match:replace all with "-"}
The square brackets ([ ]) must be used to indicate a single space character, or it will be trimmed out of existence.