Url regular matching for help

the string to be matched looks something like this:

url("http://localhost:8888/img/4ecdd7cd00b149c1ba169c2671dcdc82.png")

the result I want:

http://localhost:8888/img/4ecdd7cd00b149c1ba169c2671dcdc82.png

what I"m trying to write is regular:

let url= "url("http://localhost:8888/img/4ecdd7cd00b149c1ba169c2671dcdc82.png")"
let reg = /[^url("")]+[^\s]*/gi;
            
reg.exec(url)

print result:


your regular string doesn't need to be regular, just intercept the string

str = "url(xxx)"
str.substring(4,str.length-1) // xxx

reg=/url\((.*?)\)/

clipboard.png


var url= 'url("http://localhost:8888/img/4ecdd7cd00b149c1ba169c2671dcdc82.png")'
var reg = /^url\(\"(.*)\"\)/;
console.log(reg.exec(url)[1])

when you encounter a scene and write a regular, and you don't know if it's right or what's wrong, you can go to regex101.com to see what your regular means.


 let url= 'url("http://localhost:8888/img/4ecdd7cd00b149c1ba169c2671dcdc82.png")'
 let reg = /\((.+?)\)/g,
     reg2 = /\"(.+?)\"/g;
            
console.log(reg2.exec(reg.exec(url)[1])[1])

str.replace(/url\("([^"]*)"\)/i,"$1");
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9cfa0-476f6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9cfa0-476f6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?