码迷,mamicode.com
首页 > 其他好文 > 详细

preg_replace 方法

时间:2015-04-16 13:47:01      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:

标红关键字

$text = "Sample sentence from KomunitasWeb, regex has become popular in web programming. Now we learn regex. According to wikipedia, Regular expressions (abbreviated as regex or
regexp, with plural forms regexes, regexps, or regexen) are written in a formal language that can be interpreted by a regular expression processor";
$text = preg_replace("/(regex)/", ‘<span style="background:#5fc9f6">\1</span>‘, $text);
echo $text;

  

preg_replace 方法

标签:

原文地址:http://www.cnblogs.com/vania/p/4431641.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!