matchtext question using regex
Jim Ault
JimAultWins at yahoo.com
Sat May 5 18:25:51 EDT 2007
try studying the "|" symbol, which is OR
There are many ways of using it with strings and substrings and patterns.
Jim Ault
Las Vegas
On 5/4/07 10:41 AM, "ron" <rbarber at yhb.att.ne.jp> wrote:
> Regex question for use in matchtext
>
> I want to find word A followed by word B. (quickly)
> So:
> put "this is my big dog called cat." into thetext
> put "my.{0,5}dog" into reg
>
> And
> put matchtext(thetext,reg)
> returns true because I use a period so it is counting characters but I
> need it to count words. I have tried various combinations of \b and \w
> to no avail.
>
> Something like :
> put "my([^ ]* ){0,5}dog" into reg
> works but only for words followed by spaces, not punctuation for
> example. These could be included but surely there is a more elegant and
> faster way?
>
> Can someone help me out with this?
>
>
> BTW, is it true that setting the wholematches to true and using
> wordoffset only returns 'words' that are followed by a space? So that
> in the example sentence above, 'cat' is not found because it is
> followed by a period? Is this correct?
>
>
> Thanks
> Ron
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list