I want to find last matched word in a sentence using regex. I searched for this functionality and found negative lookahead.
Ex: To find "foo" in "This foo is not same as the foo"
Here i need to find last matched "foo" 's index. For this I am using javascript search function with search(regex) where regex is foo(?!.*foo)
problem is that search is not returning correct index (it may be regex issue).This feature is same as chrome's find feature where up arrow finds previous match.So I want to know if i need to change my regex ?
Thanks