Regex (matchChunk) help...

Glen Bojsza gbojsza at gmail.com
Fri Jun 15 12:57:10 EDT 2018


Hi Jerry,

I may be wrong but it looks like your solution assumes that the line has
the beginning and ending I am looking for in the first and last
positions...in my example text that I gave it was all one line and the
string I am looking for is somewhere in the middle. I may not have been
clear but the example text looks like a paragraph with multiple lines but
it is actually a single line and the formatting of it may be deceiving.

On Fri, Jun 15, 2018 at 12:27 PM, Jerry Jensen via use-livecode <
use-livecode at lists.runrev.com> wrote:

> Will this do what you want? (untested)
>
> put empty into tExtract
> repeat for each line L in bigText
>   if char -9 to -1 of L is “skyrider1” then
>     if char 1 to 9 of L is “selkirkst” then
>       put L & return after tExtract
>     end if
>   end if
> end repeat
> if char -1 of tExtract is return then delete char -1 of tExtract
>
> *Start of line *
> > 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
> > *selkirkst is
> > 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
> > *selkirkst* function
> > 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.)
> *End of line*
>



More information about the use-livecode mailing list