我想获得在JavaScript中进行正则表达式匹配的帮助
仅匹配数字:
如果行(奇数)的数字大于25并且该行
(甚至)后面有“苹果”一词。
说明:
第一行的值(29)属于第二行(“第一|可可苹果是”)
第三行的值(23)到第四行(“第二|测试文本”)...依此类推...
我将在TEXT中使用它:
29% OK
First | Cocoa Apples are
23% NOT
Second | Test Text
18% NOT
Third | Mango Alpa Tango
16% NOT
Fourth | Apples are
33% OK
Fifth | Text Testing App
10% NOT
Sixth | Apples are Gold Duck
28% OK
Seventh | Alpa Apples are Tango
66% OK
Eighth | Oh My Apples are Avocado
20% NOT
Ninth | This Is My Text
25% NOT
Tenth | This Is Hard
最佳答案
尝试这个:
/(2[5-9]|[3-9][0-9])%(?=.*\n.*Apples)/g
关于javascript - 仅在条件为真时匹配,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39578518/