我有一个文本看起来像这样:分割正则表达式;保持分隔符
This is [!img|http://imageURL] text containing [!img|http://imageURL2] some images in it
所以现在我想要拆分此字符串的部分,并保持分隔符。 我已经想通了,这工作,分割字符串,但它不把分隔符:
\[!img\|.*\]
而在其他一些帖子中,我看到,我需要添加?<=
保持分隔符。 所以我同时连接,但我得到的错误信息:Lookbehinds need to be zero-width, thus quantifiers are not allowed
下面是完整的正则表达式引发此错误:
(?<=\[!img\|.*\])
我期望的那样结果:
[This is; [!img|http://imageURL]; text containing; [!img|http://imageURL2]; some images in it]
所以最新最好的方式来解决它?
哟!我已经尝试过,但它不会工作看上面的问题 – ForJ9