Reputation: 4865
I am working on a widget & here is the code I have so far:
$(".number-plate").html(function(i, h) {
return h.replace(/([a-z0-9])/ig, '<img src="plate-widget/$1.gif" alt="$1" />');
});
What I would like to happen is if the individual characters make up the work 'ANY', then I want to display a single image of the word, instead of 3 different images?
Is there a way to do this?
Any help would be greatly appreciated, Thanks
Upvotes: 0
Views: 382
Reputation: 319571
If I understood you correctly you want to match the word "ANY"
or a single characters, if this is so you could use the following:
/(ANY|[A-Za-z0-9])/g
Upvotes: 1