User Tools

Site Tools


collection:Substrings_In

Differences

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

Link to this comparison view

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 19:56]
JMichaelTX Marked areas that need fixing.
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 6: Line 8:
  
 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 position of the match or the range (position,​length) of the match.
 +
 +So, let's assume you've used a variable theRange to store the range in a For Each action.
 +
 +It can be referenced by:
 +
 +theRange[1]
 +theRange[2]
 +
 +The range is a comma separated list of values:
 +
 +n1,n2
 +
 +OR
 +
 +Start-of-Match,​Length-of-Match
 +
 +So the the normal Keyboard Maestro substring notation works with it.
 +
 +It's all too easy to get misdirected into thinking the numbers reference match 1, match 2 – but this is not the case.\\
 +FIXME -- Peter, then how are the numbers obtained? ​ Detailed example please.
 +
 +Here's a practical example
 +
 +{{ :​collection:​for_each_apply_style_to_clipboard.jpg?​nolink |}}
 +
 +FIXME -- the above screenshot needs correcting or clarifying. ​ Where does the Variable "​Verse"​ come from?  It seems to me that it should be the variable "​matchVar",​ which is set at the top of the "For Each" Action. ​ Also, to be meaningful, you need to show the source data that is being used by the "For Each" Action.
 +
 +===== See Also =====
 +
 +==== Actions ====
 +
 +* [[action:​For_Each|For Each]]
 +
  
collection/Substrings_In.txt · Last modified: 2021/10/14 03:55 by peternlewis