R
Richard Bell
I'm a bit new to perl and am trying to emulate the behavior of a free
text search engine that has a feature
is w2 taken
taken to mean the word 'is' within 2 words of the word 'taken' where
the distance (2) and the words ('is', 'taken') are arbitrary.
I've a variable that looks like this
'one two three four and so on words seperated by spaces that goes on
and on and on and on for a very long way'
that I'm tring to process.
I'm having a problem finding a regular expression that handles this
case. Something like
"\bis\b(what goes here){0,2}\btaken\b"
Can someone point me in the right direction?
I assume that $pos will point to the last character matched. Is this
correct? How can I know the index of the first character matched? Can
I know what '(what goes here)' matched? How? As part of this
process, I'm trying to track what characters in the string were
matched by a number of regular expressions by getting $pos and keeping
a bit map of the characters matched.
Thanks.
Richard
text search engine that has a feature
is w2 taken
taken to mean the word 'is' within 2 words of the word 'taken' where
the distance (2) and the words ('is', 'taken') are arbitrary.
I've a variable that looks like this
'one two three four and so on words seperated by spaces that goes on
and on and on and on for a very long way'
that I'm tring to process.
I'm having a problem finding a regular expression that handles this
case. Something like
"\bis\b(what goes here){0,2}\btaken\b"
Can someone point me in the right direction?
I assume that $pos will point to the last character matched. Is this
correct? How can I know the index of the first character matched? Can
I know what '(what goes here)' matched? How? As part of this
process, I'm trying to track what characters in the string were
matched by a number of regular expressions by getting $pos and keeping
a bit map of the characters matched.
Thanks.
Richard