I can have a string that looks like this as an example:
sometext<a title="Wink"><img src="http:\\www.seemstatic.com\images\transparent.png" class="emoWink"></a>somemore text<a title="Wink"><img src="http:\\www.seemstatic.com\images\transparent.png" class="emoWink"></a>endof text...
I have the following Javascript that matches the above string, and replaces it with :):
subject = subject.replace(/<a title="Smile"><img.*<\/a>/, ':)');
The catch is it’s not greedy… it matches both occurrences rather then just one.
How would I change this code to match just the first occurrence?
you need to make it non greedy by adding a question mark ?
So in your case, something like