jquery - Regex of a string -


this question has answer here:

i'm trying write regular expression match string. @ moment have regex:

regx = /wid=\d+(\.\d)*/g, 

which match wid=100 in following link/string:

image/hugoboss/test%2dimg?wid=100 

however want extend link/string :

image/hugoboss/test%2dimg?wid=100&crop=0,0,960,650 

so ends format &crop=0,0,960,650. how adapt regex matches wid=100&crop=0,0,960,650

thanks!

get matched group index 1

\?(.*)$ 

online demo

the regex looks after ? till end string/line.

sample code:

var str="image/hugoboss/test%2dimg?wid=100&crop=0,0,960,650"; var re = /\?(.*)$/;  console.log(str.match(re)[1]); 

output:

wid=100&crop=0,0,960,650 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -