[英]How to convert a .Net regular expression to php
我有一个正则表达式,如果该短语不包含在HTML锚标记或IMG标签中,则该表达式用于替换该短语。 在此示例中,要搜索的短语是“ hello world”
.net正则表达式为
(?<!<a [^<]+)(?<!<img [^<]+)(?<=[ ,.;!]+)hello world(?=[ ,.;&!]+)(?!!.*</a>)
EG正则表达式应匹配“ hello world”,例如
"one two three hello world four five"
但是不应该用类似这样的词组来打招呼世界
"one two three <a href='index.html'> hello world </a> four five"
要么
"one two three <img alt='hello world' \>four five"
从我最初开发.Net版本起,它与以下问题相关联。 如果它是html锚标记中的文本,则不匹配字符串的正则表达式
任何有关如何将其转换为php regex的指导将不胜感激。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.