$text = "/1/2<br />до"; $text = preg_replace('~/.+<br />~U', '<FONT color="red">\\\0</font>', $text); echo $text; 

Here is the code.
The script inserts a <FONT> to what is from / to </br> inclusive. The question is this. Help to supplement the regular calendar so that the program replaces the font only when there is any other character in front of / except / i.e. if it is "http: // 1/2 <br /> before" the system will lose all this business. I tried to try, but nothing happened.

  • like this [^ /]? - zb '
  • 3
    More true: ~ (? <! /) /.+ ~ U - ReinRaus


1 answer 1

Reply from comments

 ~(?<!/)/.+<br />~U