Reputation: 2830
I want a Regex
for Somevalue.......Somevalue
. Like:
vikas?notsure233R&kratika
vikas?hopeitwork3&kratika
vikas?wouldItWork&kratika
I tried
(vikas?[(.*?)]&kratika)
but it's not working.
Upvotes: 0
Views: 54
Reputation: 20424
it should be vikas\?(.*?)&kratika
Update:
if you're trying to parse those URLs, you can decode them first by using HttpUtility.HtmlDecode()
.
Then use HttpUtility.ParseQueryString()
to parse the URL:
String DecodedUrl = HttpUtility.HtmlDecode(YourUrl);
NameValueCollection UrlParameters = HttpUtility.ParseQueryString(DecodedUrl);
if (UrlParameters.AllKeys.Contains("SOMETHING")) {
// do something
}
Upvotes: 3
Reputation: 8293
Several problems here.
?
is a special character inside a regex, you have to escape it.
[]
makes a character class, so you're trying to match either *, . or ?
So, all in all:
vikas\?(.*?)&kratika
Upvotes: 0