Page 1 of 1

matchChunk problem

Posted: Mon Oct 19, 2009 9:41 pm
by gyroscope
Hi, I've some code which includes:

Code: Select all

repeat with CharGrow=1 to tCharCount
                  put char 1 to tCharCount of word tWords of fld "INPUT" into GrowingVar
                  
                  if matchChunk(TheWord,^GrowingVar) is false then
                     delete word TheWord of fld ("List" && CopyLists& "C"))
                  end if
               end repeat
Rev gives an error at the matchChunk line; it doesn't seem to like the symbol "^" but this, so the dictionary tell me (in the matchChunk and matchText entry), means "begins with" in this situation.

Has anyone any ideas how to solve this please:?:

:)

PS I guess I could use matchText instead of matchChunk, as I'm dealing with individual words, is that correct?

Posted: Mon Oct 19, 2009 9:54 pm
by bn
gyroscope,
^GrowingVar
did you try

Code: Select all

"^"&GrowingVar
?
maybe that is it?
regards
Bernd

Posted: Mon Oct 19, 2009 10:59 pm
by gyroscope
Hi Bernd, thanks very much, it works! (I suddenly realised I was putting the symbol "^" outside of the quote).

:)

Posted: Mon Oct 19, 2009 11:30 pm
by bn
gyroscope,

this works for me

Code: Select all

if MatchChunk(theWord,"(^"& GrowingVar &")") is false
I figured it out with the Rinaldi ReExBuilder in the plugins folder under the development menu.
But really RegEx for me is complicated and I always goof up on it...

regards
Bernd

Posted: Tue Oct 20, 2009 5:49 pm
by gyroscope
Thanks again Bernd, that's spot on!

:)