BBcode 替换的正则表达式
Regular Expression for BBcode replacement
我需要 PCRE 正则表达式来替换
This
[quote author=MEMBER link=topic=8.msg1111 date=1438798587]
sample text[/quote]
To this one
[quote="MEMBER, post: 1111"]sample text[/quote]
所以我需要:
- 删除属性
date=xxxxxxxxxx
并将 "
放在标签末尾(在 post id 之后)
- 将
link=topic=8.msg
替换为post:
- 将
author=
替换为="
有人可以帮忙吗?
谢谢!
嗯,你可以试试这个:
\[quote\sauthor=([^\s]+)\s*.*?msg(\d+)\s[^]]*]\s*([^[]*)(\[\/quote])
参见this demo。
虽然我不能确定这是否真的符合您的输入类型,因为您只提供了一个样本。
我需要 PCRE 正则表达式来替换
This
[quote author=MEMBER link=topic=8.msg1111 date=1438798587]
sample text[/quote]
To this one
[quote="MEMBER, post: 1111"]sample text[/quote]
所以我需要:
- 删除属性
date=xxxxxxxxxx
并将"
放在标签末尾(在 post id 之后) - 将
link=topic=8.msg
替换为post:
- 将
author=
替换为="
有人可以帮忙吗? 谢谢!
嗯,你可以试试这个:
\[quote\sauthor=([^\s]+)\s*.*?msg(\d+)\s[^]]*]\s*([^[]*)(\[\/quote])
参见this demo。
虽然我不能确定这是否真的符合您的输入类型,因为您只提供了一个样本。