jquery - Regex of a string -
this question has answer here:
- how value parameters? 41 answers
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
\?(.*)$
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
Post a Comment