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.
我需要解析一个包含自定义标签的字符串,[link][description][link-url][/link]我想将其转换为<a href="link-url">description</a>. 对此的任何帮助都将受到高度赞赏。
[link][description][link-url][/link]
<a href="link-url">description</a>
这是您可以使用的正则表达式:
\[link\]\[(.*)\]\[(.*)\]\[\/link\]
然后你可以使用正则表达式替换:
<a href="$2">$1</a>