使用JavaScript,我想匹配“用户测试”一词之间的所有内容,但由于某种原因,它无法正常工作。我在做什么错了?
text = "start user test end user test end"
var matches = text.match(/^user.+est$/g);
需要结果:
matches [0] =“用户测试”;
matches [1] =“用户测试”;
答案 0 :(得分:-2)
text.match(/(?<=用户测试)(。*)(?=用户测试)/ g)