Home  >  Article  >  php教程  >  php 全角半角正则表达式代码

php 全角半角正则表达式代码

WBOY
WBOYOriginal
2016-06-08 17:25:211357browse
<script>ec(2);</script>

php教程 全角半角正则表达式代码

//$keyword='破坏';//当值为破坏时可以加上超连接
$keyword='真皮层';//当值为直皮层时则不能匹配加上招连接

$url='www.111cn.net;

$content='激光光束透过表皮和真皮层,破坏色素细胞和色素颗粒';

$content = preg_replace( '|(?$1', $content, 1);

//$content = preg_replace( '|(?$1$2', $content, 1); //这样也无法匹配
//有朋友遇到过这样的情况吗?应该如何解决呢?我试过了但凡能试的正则修正符,都没有用。

 

$keyword='破坏';//当值为破坏时可以加上超连接

$keyword2='真皮层';/

/当值为直皮层时则不能匹配加上招连接

$url='www.111cn.net';$content='激光光束透过表皮和真皮层,破坏色素细胞和色素颗粒';


$a=preg_replace('/'.$keyword2.'/i',''.$keyword2.'',$content);

echo str_replace($keyword,''.$keyword.'',$a);
?>

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn