I am trying to parse product names that have several abbreviations for sizes. For example, the medium may be
m, medium, med
I tried simple
preg_match('/m|medium|med/i',$prod_name,$matches);
which is great for "m xyz product". However, when I try "product s / m abc", I get a false positive match. I also tried
preg_match('/\bm\b|\bmedium\b|\bmed\b/i',$prod_name,$matches);
to make him find the word, but m in s / m is still matched. I assume this is because the engine treats the "/" in the title as a word delimiter?
So, to summarize, I need to match "m" in the string, but not "s / m" or "small", etc. Any help is appreciated.
Conor source share