I'm currently writing a routine to extract one, two and three word phrases from a string but with two or three word phrases I'm not getting all the phrases. For example
the string "blah blah blah" will show one ocurance of "blah blah" when really there is two.
My problem is that perl continues after the end of the last match so with a string of "This is a test" I'll get
"this is" and "a test" but I won't get "is a" even though it's a valiv phrase.
Then don't do it that way. Match only single words, and take the array of single words and work with that. If you're worried about in-between characters, and only want a single space between, do another match for contiguous strings of non-word characters, and then you're set to write some code that ties things together.
Then don't do it that way. Match only single words, and take the array of single words and work with that. If you're worried about in-between characters, and only want a single space between, do another match for contiguous strings of non-word characters, and then you're set to write some code that ties things together.
Thats what I was going to do but I was hoping that using regexp I could do it neater and faster than using a split array
I'd expect something simple like this could be done easily with regexp. I was hoping there was a flag or something that I didn't know about so it could look at more than the last match.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.