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

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

WBOY
Release: 2016-06-23 14:12:56
Original
763 people have browsed it


我想在
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内容
Copy after login

谢谢大神。膜拜!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template