Page 1 of 1

within "n" words

Posted: Mon Apr 01, 2002 11:19 am
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?

within "n" words

Posted: Mon Apr 01, 2002 12:18 pm
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]+