This shows you the differences between two versions of the page.
Next revision | Previous revision Next revision Both sides next revision | ||
collection:Substrings_In [2015/07/14 00:49] peternlewis created |
collection:Substrings_In [2018/05/09 22:59] peternlewis Improved description of range |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== For Each Substrings In RegEx Match ====== | ||
+ | |||
The //Substrings In collection// contains the matches in the specified source. | The //Substrings In collection// contains the matches in the specified source. | ||
Line 5: | Line 7: | ||
You can scan for exact string matches, case insensitive string matches, or regular expression matches. | You can scan for exact string matches, case insensitive string matches, or regular expression matches. | ||
- | The result, stored in the [[action:For_Each| For Each action ]] variable, can be either the matched string, the position of the match or the range (position,length) of the match. | + | The result, stored in the [[action:For_Each| For Each action ]] variable, can be either: |
+ | |||
+ | * the matched string: the For Each variable is set to the value of the matched string. | ||
+ | * the position of the match: the For Each variable is set to the position of the match (starting at 1). | ||
+ | * the range of the match: the For Each variable is set to the range (position,length) of the match. | ||
+ | |||
+ | For the range option, the variable contains the position and length with a comma between them, so you can use the normal variable array indexing to access the two numbers, eg if the For Each variable is theRange, then theRange[1] would be the position, and theRange[2] would be the length of the match. | ||
+ | |||
+ | Here's a practical example which superscripts all the numbers in the clipboard. | ||
+ | |||
+ | {{ :collection:for_each_apply_style_to_clipboard.png?nolink&510 | Apply Superscript to Numbers in Clipboard }} | ||
+ | |||
+ | ===== See Also ===== | ||
+ | |||
+ | ==== Actions ==== | ||
+ | |||
+ | * [[action:For_Each|For Each]] | ||