Home  >  Article  >  Backend Development  >  正则小白求正则高手解决问题

正则小白求正则高手解决问题

WBOY
WBOYOriginal
2016-06-23 14:12:56745browse


我想在
88-1
的88-1前面加一个字符串怎么写呀?


回复讨论(解决方案)

$s = "<a onclick=window.open('a.html')>88-1</a>";echo preg_replace('/(<a[^>]*?>)(.*?)<\/a>/', '${1}test${2}</a>', $s);//输出后看html内容

谢谢大神。膜拜!

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
Previous article:求教小问题。Next article:奇怪的问题