Once upon a time?

David Bovill david at openpartnership.net
Fri Feb 2 07:55:12 EST 2007


put "once upon" is among the words of "once upon a time" = false (which
surprised me!)

put "once,upon" is among the items of "once,upon,a,time" = true

set the wholeMatches to true
set the itemDelimiter to space
put "once upon" is among the items of "once upon a time" = true

but with 2 spaces:

set the wholeMatches to true
set the itemDelimiter to space
put "once upon" is among the items of "once  upon a time" = false

Is there a simple way to avoid regular expressions here? The aim is to be
able to detect the exact two words together, but tolerant of variable white
space.

Something like this works but is ugly:

put "(?mi)\W*once\s+upon\s+.*" into regularExpression
put matchChunk(" once  upon  a time", regularExpression)



More information about the use-livecode mailing list