[英]Using regex to get values in multiline text
我有以下情況:
我想使用Regex在下面的JS代碼的.html()之后提取“”之間的所有字符串。
到目前為止,這是我所做的:
(\.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)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.