目前我有这个正则表达式将段落拆分成句子:/[^\.!\?]+[\.!\?]+/g
。但问题是我的段落不仅仅是文本段落。我在其中有这样的链接:
This is text and here is a <value="link" href="http://link.com?param=test"> which directs to another page. So I don't want to split at the anything inside the link above.
我想将其拆分为一个数组,例如:
['This is text and here is a <value="link" href="http://link.com?param=test"> which directs to another page.', 'So I don't want to split at the anything inside the link above.']
什么正则表达式可以做到这一点?
最佳答案
试试这个:
(.+?[\.!\?](?!.+?>)\s*)
关于javascript - 如何构建一个将段落拆分为句子的正则表达式,但不会拆分 <> 内的任何标点符号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17194643/