我有一个文字
<1.1.1>This is para one with <1.1.2>more than five words. I <1.1.3>is trying to test grammar <1.1.4>API with this. <1.2.1>This are para two, let's <1.2.2>test it. I am using <1.2.3>it <1.3.1>
在此我想要匹配
is para one with more than five words. I is trying to test grammar API with this. T
我试过一个reg ex
(?:(\<([0-9]*\.[0-9]*\.[0-9]*)\>))(This is para one with more)
我想要的结果如下:
is para one with <1.1.2>more than five words. I <1.1.3>is trying to test grammar <1.1.4>API with this. <1.2.1>T
但是无法找到解决方案,我如何能够递归地匹配排除单词。
答案 0 :(得分:3)
你可以做到
let str = "<1.1.1>This is para one with <1.1.2>more than five words. I <1.1.3>is trying to test grammar <1.1.4>API with this. <1.2.1>This are para two, let's <1.2.2>test it. I am using <1.2.3>it <1.3.1>";
str = str.replace(/<\d\.\d\.\d>/g, '');
console.log(str);
&#13;