Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 PHPpreg_replace()查找公司名称并将其替换为他们的徽标。但是,这也需要在其末尾包含注册商标符号(R)。那么,如何编写正则表达式来匹配以下内容?
preg_replace()
Company Name®或Company Name或Company Name<sup>®</sup>
Company Name®
Company Name
Company Name<sup>®</sup>
提前致谢!
/Company Name(®|<sup>®<\/sup>|)/
或者,为了更清楚:
/Company Name(®|<sup>®<\/sup>)?/
如果您之前将 html 切掉,那就更好了,然后只使用
/Company Name®?/