September 15th, 2010, 11:27 AM
Check 2nd word in sentence.
"Try and find it and please let me know".
here there are two "and" in sentence. i want a Regex that dosn't match the 2nd "and" (since the position is 2nd word in the sentence). but it has to match 5th "and", since it is not at position 2nd. Please help.
September 15th, 2010, 11:45 AM
Sorry, I don't understand your question.
Are you trying to check whether the second word in a sentence is also contained somewhere else? Or are you checking for a specific word ('and' in this example) and seeing if it's contained in the sentence in some position other than second?
September 15th, 2010, 12:03 PM
word contained in sentence other than second
Thanks for the reply and Sorry for the confusion, I am checking a specific word 'and', seeing if it's contained in the sentence in some position other than second
Originally Posted by ishnid
September 15th, 2010, 12:33 PM
I wouldn't use a regexp for this. I'd suggest splitting the string into its individual words, then checking the resulting array for 'and' (other than the second position).