• 0

ereg_replace


Question

so i have this

$input = ereg_replace('\[font="([[:graph:]]+)"\]([[:graph:]]+)\[/font\]', '<font class="\\1">\\2</font>', $input);

which works fine except when there is a lind break after the . please help....

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0
so i have this

$input = ereg_replace('\[font="([[:graph:]]+)"\]([[:graph:]]+)\[/font\]', '<font class="\\1">\\2</font>', $input);

which works fine except when there is a lind break after the . please help....

try this

$input = preg_replace('#\[font="([[:graph:]]+)"\]([[:graph:]]+)\[/font\]#s', '<font class="\\1">\\2</font>', $input);

use preg_xxx functions instead of ereg_xxx functions because preg_xxx are faster

am not fully sure what "[:graph:]" is but I never seen it in preg_xxx before

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.