Using PHP how can i apply HTMLentities() to a backreference in a preg_replace() call?

Posted by Gary Willoughby on Stack Overflow See other posts from Stack Overflow or by Gary Willoughby
Published on 2010-06-06T22:19:27Z Indexed on 2010/06/06 22:22 UTC
Read the original article Hit count: 249

Filed under:
|

At the minute i have:

$Text = preg_replace("/\[code\](.*?)\[\/code\]/s", "<mytag>\\1</mytag>", $Text);

how can i escape the backreference using htmlentities()?

© Stack Overflow or respective owner

Related posts about php

Related posts about regex