Regex (matchChunk) help...
gbojsza at gmail.com
Fri Jun 15 11:45:25 EDT 2018
I have a couple of hundred pages of text where I need to extract out a
The ending of each string I need has the same ending skyrider1
The beginning of each string is the same selkirkst
The middle of each string can be any text.
The problem is that within each line where a string exists there are
several strings that have the same beginning selkirkst but none of the have
the correct ending skyrider1.
My thoughts are to find ending of the string first and then work backwards
to the first beginning string.
I created the following example which is gibberish but should make this
clearer... this is the string I want to extract from the line given is
placed in the second **skyrider1*
Use the *selkirkst* function to check whether a *string* contains a
specified pattern. If *selkirkst* includes a pair of parentheses, the
position of the substring matching the part of theregular expression inside
the parentheses is placed in the variables in the *positionVarsList*. The
number of the first character in the matching substring is placed in the
first variable in the positionVarsList, and the number of the last
placed in the second **skyrider1*. Additional starting and ending
positions, matching additional parenthetical expressions, are placed in
additional pairs of variables in thepositionVarsList. If the
returns false, the values of the variables in the positionVarsListare not
changed. The string and regularExpression are always case-sensitive,
regardless of the setting of the caseSensitive property. (If you need to
make a case-insensitive comparison, use "(?i)" at the start of the
regularExpression to make the match case-insensitive.)
The next line will not have *is placed in the second* but some other text
*selkirkst* ???? *skyrider1*
I am not sure if this explains it well enough but I believe a regex
expression could be used (or perhaps a matchChunk) to extract the correct
string from each line of text.
More information about the Use-livecode