regex - Fixed string Regular Expression C# -
hi want know regarding fixed-string in regular expression. how represent fixed-string, regardless of special characters or alphanumeric in c#?
for eg; have @ following string:
infinity.world.uk/members/namelist.aspx?id=-1&fid=x
the entire string before x fixed-string (ie; whole sentence appear same) x decimal variable.
what want want append decimal number x fixed string. how express in terms of c# regular expression.
appreciate help
if need modify existing url, dont use regex, string.format
or string.replace
problem encoding of arguments
use uri , httputility instead:
var url = new uri("http://infinity.world.uk/members/namelist.aspx?id=-1&fid=x"); var query = httputility.parsequerystring(url.query); query["fid"] = 10.tostring(); var newurl = url.getleftpart(uripartial.path) + "?" + query;
result: http://infinity.world.uk/members/namelist.aspx?id=-1&fid=10
for example, using query["fid"] = "%".tostring();
correctly generate http://infinity.world.uk/members/namelist.aspx?id=-1&fid=%25
Comments
Post a Comment