我想从下面的字符串中提取所有内容,除了“开始”和“从”
从古法语,从拉丁因诺琴蒂,从无辜-‘不伤害’(基于夜间‘伤害’)。
这是我的准则:
(?:from)(.*)(?:,.from)(.*)对于这个正则表达式,我将得到Old French, from Latin innocentia和innocent- ‘not harming’ (based on nocere ‘injure’).作为结果。如何编辑regex代码段,使其能够匹配预期条件而不重复非捕获组(?:,.from)。
其结果应该是:
Old FrenchLatin innocentiainnocent- ‘not harming’ (based on nocere ‘injure’).发布于 2016-07-31 00:46:44
line="from Old French, from Latin innocentia, from innocent- ‘not harming’ (based on nocere ‘injure’)."
line.split(/, from|from/)=>
[ '',
' Old French',
' Latin innocentia',
' innocent- ‘not harming’ (based on nocere ‘injure’).' ]可能已经够近了。在线试用:https://repl.it/Chp8
发布于 2016-07-31 00:47:18
https://stackoverflow.com/questions/38679757
复制相似问题