如何使用正则表达式从引号之间提取包含所需字符串的组?

How to extract groups contains desired string from between quotes using regex?

我想使用正则表达式从引号之间提取一些字符串。正文如下:

CCKeyUpDomReady('test.asmx/asdasd', 'QMlPJZTOH09XOPCcbB2jcg==', '0OO6h+G2Tzhr5XWj1Upg0A==', '0OO6h+G2Tzhr5XWj1Upg0A==', '/qqwweq2.asmx/qqq')

预期结果必须是:

test.asmx/asdasd
/qqwweq2.asmx/qqq

我该怎么做?下面是测试平台: https://regexr.com/3n142

条件:引号之间的字符串必须包含"asmx"个单词。文字比上面显示的要多得多。您可以认为您正在网站源代码中搜索 asmx url。

See regex in use here

'((?:[^'\]|\.)*asmx(?:[^'\]|\.)*)'
  • '字面匹配
  • ((?:[^'\]|\.)*asmx(?:[^'\]|\.)*) 将以下内容捕获到捕获组 1
    • (?:[^'\]|\.)* 这是从PhiLho's answer to Regex for quoted string with escaping quotes收集到的绝妙绝招。它匹配转义 ' 或任何其他字符。
    • asmx OP 的搜索 string/criterion
    • (?:[^'\]|\.)*又是这个
  • '字面匹配

结果在捕获组中:

test.asmx/asdasd
/qqwweq2.asmx/qqq