|
Here's the thing: Lets say the string is this:
"The dog jumped over the moon. He was happy to see me. I left in a hurry"
and the word is "happy"
in that case, all I want is
"He was happy to see me."
If it's
"was happy to see me. I left in a hurry"
all I want is
"was happy to see me."
If it's
"The dog jumped over the moon. He was happy to see"
all I want is:
"He was happy to see"
splitting it on the punctuation is probably the safest way, but then I have to loop through the array to find out which split is the one that I want. Which is why regex seems to be the answer...
|