How can i use php's preg_replace with a simple string and wildcards?
If i have the string [link="*"] where * is a wildcard how could i then use php to replace the string with <a href="*"> where * 开发者_Go百科is the same value as before?
Is preg_replace the best way to do this?
Thanks, any help appreciated!
preg_replace('~\[link="(.*?)"\]~', '<a href="$1">', $text);
$link = '[link="http://www.google.com/"]';
$link = preg_replace('/\[link="(.*)"\]/', '<a href="$1">', $link);
加载中,请稍侯......
精彩评论