
Capturing subgroups of a text wave or string list

tweed
Say I have a wave or a string like:
String mStr = "foo24,bar,foo,foo35" Make /O/T mWave = {"foo24","bar","foo","foo35"}
Is there any igor function to extract the *groups* from a regex, instead of just the matching elements (like Grep)? For example, with strings
String mRegex = "(foo\d)" String capturedGroups // the following 'magic function'would put "foo2,foo3" in capturedGroups. In other words, the actual group that matched GetGroups /E=(mRegex) mStr,capturedGroups
I ask because my alternative is calling SplitString on each of the elements of the string list or text wave, which is prohibitively expensive and slow in my experience. Thanks!
June 21, 2015 at 07:30 am - Permalink