in reply to Regex Problem
Now, suppose you have regexes for words, and strings of non-word characters, it becomes easy:
But you have to create the $word_pat and $non_word_pat patterns yourself, as I do not know what you consider a word, and what not.my $word_pat = qr /.../; my $non_word_pat = qr /.../; if (/word1${non_word_pat}(?:${word_pat}${non_word_pat}){0,4}word2/) { ... no more than 4 words between word1 and word2 ... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex Problem
by remluvr (Sexton) on Oct 24, 2008 at 08:46 UTC | |
by JavaFan (Canon) on Oct 24, 2008 at 09:07 UTC |