Hi,
I have a number if regex methods which all work, however one thing just crossed my mind. I assume that there will only ever be one match and this may lead to issues in some of the selections.
Take this one:
Regex regex = new Regex(@"[?&]" + param + "=(?<value>[^&]+)");
It finds a parameter within a url, like "?content=abc"
Now I've assumed that there would only ever be one match but how could I fix the expression to only return the first match? I use this code in the method to pick up the value:
Match match = regex.Match(queryString);
return match.Success ? match.Groups["value"].Value : "";
By the way, I know it is extremely unlikely that the the above expression would return 2 matches, but I'm using it m ...
Go to the complete details ...