i need the perl compatible regular expression for this string pattern i'm trying to match.
Quote:
$word = quotemeta(stripslashes($w[word]));
$tip = stripslashes($w[tip]);
$search = "/\b$word"."s?\b/i";
$replace = "<span title=\"$tip\"><font color=\"blue\">\0</font></span>";
$search = "/\b$word"."s?\b/i";
catches the keyword we are trying to highlight, with the possibility of it being a plural (s?)
what i have noticed is that if you have an html link or an image that contains one of the key words (ex. MAF-backside.jpg or stock-essex-upper.gif) the pattern match will catch the word and screw up the link or the img tag src. Any ideas on how to modify the
$search = "/\b$word"."s?\b/i";
so it will not catch keywords embedded within a larger string (ending in .xxx) keep in mind that the \b in "/\b$word"."s?\b/i"; stands for a word boundary, the only problem is when the word is surrounded by to dashes (-) periods or anything non alphabetic or numeric, it considers that a word boundary.
post possible solutions here.
so far i have
$search = "/\b$word"."s?\b[&.a-zA-Z0-9<]*/i"; but its not 100% working yet, i need it to somehow reach the end of the string around an even larger word bounday and see if there is an extension.