我有这样的字符串
<span style="font-size: 11pt; font-family: arial, helvetica, sans-serif;">I want replace this text to other text</span>
<span style="font-size: 18pt; font-family: arial, helvetica, sans-serif;">I want replace this text to other text</span>
我想使用PHP来实现它
<span style="font-size: 11pt; font-family: arial, helvetica, sans-serif;">I want replace <a href="#">this text</a> to other text</span>
<span style="font-size: 18pt; font-family: arial, helvetica, sans-serif;">I want replace this text to other text</span>
我想只有文字有span样式字体大小:11pt替换 请帮帮我 感谢
答案 0 :(得分:0)
根据你的意见,这个正则表达式将起作用
((?:.*?<span.*?style\s*=\s*"font-size\s*:\s*11pt[^>]*>))(.+?)(this text)(.*?(?<=<\/span>|$))
<强> Regex Demo 强>