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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to