My input text is as blow:
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">2</string>
What regex pattern to use to extract the number from the above input?
var pattern = "<string ?>?</string>"; // how to write this?
var match = Regex.Match(input, pattern, RegexOptions.IgnoreCase);
Thanks,
Another aproach using LinqToXml:
Update
And for regex: I would extend solution from @Oded with
(?<=startRegex)and(?=endRegex)(lookbehind and lookahead), so the unnecessary<string>tag will be omitted in match value.