""" 之间的 Javascript 正则表达式文本

如何在 javascript 的正则表达式"""之间获取文本?"""

例子:

"""hello world""" 应该给 hello world

""" hi """ """world""" 应该给 [hi, world]


慕桂英3389331
浏览 109回答 1
1回答

沧海一幻觉

干得好:(?<=""") ?\w+ ?( \w+)*(?=""")解释(?<=""")&nbsp; &nbsp;--->&nbsp; &nbsp;make sure three quotes appear prior to a word&nbsp;?&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--->&nbsp; &nbsp;optional space\w+&nbsp; &nbsp; &nbsp; &nbsp; --->&nbsp; &nbsp;match any word characters( \w+)*&nbsp; &nbsp; --->&nbsp; &nbsp;match 0 or more spaced out words(?+""")&nbsp; &nbsp; --->&nbsp; &nbsp;ensure that there's following close quotes在这里看到它的作用
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript