within "n" words

Post Reply
kzinda
Posts: 62
Joined: Fri Nov 30, 2001 6:18 am

within "n" words

Post by kzinda »

Instead of having texis search within "n" characters, e.g. word1 word2 w/16, would the rex expression to search within, say, 3 words be:

word1 word2 w/[a-z]+\space+=[a-z]\space?[a-z]\space?
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

within "n" words

Post by mark »

No. Try the above with rex -x to see what it means.

If estimating words to be 6 chars on average and multiplying to get w/18 is not good enough for you, a reasonable approximation of a word would be
[^\alnum]+[\alnum]+
repeat as needed for more words. Reverse for start delimiter. Use cap W to include delimiters.
W/[\alnum]+[^\alnum]+[\alnum]+[^\alnum]+[\alnum]+[^\alnum]+ W/[^\alnum]+[\alnum]+[^\alnum]+[\alnum]+[^\alnum]+[\alnum]+
Post Reply