使用正则表达式在多行文本中获取值

Using regex to get values in multiline text

本文关键字:文本 获取 正则表达式      更新时间:2023-09-26

我有以下场景:

我想使用Regex在.html(下面的JS代码)之后提取"之间的所有字符串。

这是我到目前为止所做的:

('.html'()?"(.+)"'s*'+*
'.html'("(.+)"('s*'+'s*'n's*"(.+)")*

但不是对所有行都有效。

任何帮助都将是非常感激的。

谢谢。JavaScript代码

     sym.getSymbol("popup").$("main").html("Delamination at Sharp Points and Corners");
     sym.getSymbol("popup").$("sub").html("<span style='font-family: abel_probold'>Defect:</span> Bond separates easily at the tip of a sharp edge or corner.<br><br>" +
         "<span style='font-family: abel_probold'>Common cause:</span> Very little adhesive area to hold the application in place<br><br>" +
         "<span style='font-family: abel_probold'>Corrective action:</span> When possible, eliminate sharp points. Validate bond performance with wash testing.</div>");

你可以匹配引号和非引号之间的所有内容:

string.match(/'"([^'"]*)'"/g)

你可以使用这个正则表达式:

string.match(/'.html'((.+?)')/gs)
https://regex101.com/r/xW5yR3/1