我试图在我的字符串中找到所有的“测试”匹配:const search = "test";const re = new RegExp(regexString, "gi");const fullText = "my test string with a lot of tests that should match the tes
我有格式的字符串:但是,有时只有X=...Y=...部件存在,而不是Z=...部件,例如:还可以捕获值中的逗号,例如:如果存在,我如何编写正则表达式来捕获Foo、Bar和Qux (本例中只是占位符)?# Works when Z is not present但我很难写出一个能匹配这两种情况的正则表达式我