c# - regular expression to retain only img src text -
i have string given:
< img src='^f('himagepath')[1].label()^megamillions_nobkgd.png'/>
i want regular expression return me "megamillions_nobkgd.png" part of above string result after using regular expression should "megamillions_nobkgd.png" stored in string variable.
thanks in advance
then believe should give need, more or less:
var x = "< img src='^f('himagepath')[1].label()^megamillions_nobkgd.png'/>"; // result be: // ^f('himagepath')[1].label()^megamillions_nobkgd.png' var result = regex.match(x, @"\^f\((.)*'").value;
of course simpler , more readable solution this, , avoid using regex completely:
var x = "<img src='^f('himagepath')[1].label()^megamillions_nobkgd.png'/>"; var urlstart = x.indexof("'") + 1; var urlstop = x.lastindexof("'"); var result = x.substring(urlstart, (urlstop - urlstart));
Comments
Post a Comment