|  | Posted by Rory Browne on 06/08/05 18:08 
On 6/8/05, Jay Blanchard <jay.blanchard@niicommunications.com> wrote:> [snip]
 > I don't think so. If I'm reading your code correctly you still have
 > the same problem, as I outlined above. There is no simple solution to
 > this. It either involves advanced regex(more advanced than my
 > understanding of it), or a proper parser.
 >
 > <?pseudo_code
 >
 > function highlight_html_string($needle, $haystack);
 >
 > $retval = "";
 > $i = 0;
 > while($i < strlen($haystack)){
 >   $str = get_text_between_certain_point_and_first_instance_of_<($i);
 >   $str = preg_replace(what john said above);
 >   $str .= get_tag_text($i);
 >   $retval .= $str;
 >   $i += strlen($str);
 > }
 >
 > return $retval;
 > ?>
 > [/snip]
 >
 > Also it should be noted that the <b> tag pair has really been depricated
 > in favor of <strong> tags. Here is another thought, can you ignore your
 > search string where it has tags immediately before and after it, so that
 > >body< could be ignored?
 >
 Hmmm, that would solve the above specific mentioned problem. how about
 something like <tag body="whatever"> or <tag whatever="body"> assuming
 that body is the word to be highlighted.
  Navigation: [Reply to this message] |