using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(\&|\?)(id=\d+)";
string input = @"//detail.tmall.com/item.htm?abtest=&pvid=42b3a520-35a1-47f8-abe8-572bef4a430f&pos=1&abbucket=&acm=03054.1003.1.2768562&id=604432657613&scm=1007.16862.95220.23864_0_0&utparam=%7B%22x_hestia_source%22%3A%2223864%22%2C%22x_object_type%22%3A%22item%22%2C%22x_mt%22%3A0%2C%22x_src%22%3A%2223864%22%2C%22x_pos%22%3A1%2C%22x_pvid%22%3A%2242b3a520-35a1-47f8-abe8-572bef4a430f%22%2C%22x_object_id%22%3A604432657613%7D";
RegexOptions options = RegexOptions.Singleline;
Match m = Regex.Match(input, pattern, options);
Console.WriteLine("'{0}' found at index {1}", m.Value, m.Index);
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx