I’m using Jquery(don’t know if that’s relevant), here’s the regex:
var re = new RegExp('\\b' + a_filter + '\\b');
So it matches whole words in the variabe a_filter which has a bunch of words in it. Right now it will match ‘wrench’, but not ‘wrenches’. It will match ‘chair’, but not ‘chairs’, it will match “john” but not “john’s”. I’ve been trying but I can’t figure it out.
Can someone please help me adjust my regex above to allow for these at the end of the word?
s es 's are what I want to allow at the end of a word match, so i don’t have to include every single possible variation of each word. I think that’s all the word endings that there really are that someone would type, if you know more, it would be great to get help, THANKS!
EDIT: here’s my jsfiddle, maybe I had a_filter mixed up with filter_tags, I think i’m doing it backwards, ugh. ???
I have a group of your endings after the filter concatenation, with
?to require 0 or 1 match.Example: http://jsfiddle.net/qctAG/ (
alert()warning. you’ll get 4 of them)