A common scenario, get: Tag background image link:
For example string: var bgImg = "url
(\"https://img30./sku/jfs/t26203/262/100869187/204098/1d1479e9/\")";
script:
var backgroundImageRegex=/(?<=url\(").+(?="\))/; var matchResult=(backgroundImageRegex); if(>0){ alert(matchResult[0]); }
Key points:
0-Special characters: ()" These three need to be escaped
1-After getting the specified string: (?<=Specified string)
2-Get the specified string before: (?=Specified string)
Summarize
The above is the string before the JS regular expression introduced by the editor to obtain the specified characters after obtaining the specified characters. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to everyone in time. Thank you very much for your support for my website!