matchChunk problem

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

matchChunk problem

Post by gyroscope » Mon Oct 19, 2009 9:41 pm

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?
Last edited by gyroscope on Mon Oct 19, 2009 11:01 pm, edited 4 times in total.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Mon Oct 19, 2009 9:54 pm

gyroscope,
^GrowingVar
did you try

Code: Select all

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

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Post by gyroscope » Mon Oct 19, 2009 10:59 pm

Hi Bernd, thanks very much, it works! (I suddenly realised I was putting the symbol "^" outside of the quote).

:)

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Mon Oct 19, 2009 11:30 pm

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

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Contact:

Post by gyroscope » Tue Oct 20, 2009 5:49 pm

Thanks again Bernd, that's spot on!

:)

Post Reply