正则表达式获取URL参数 c#

2024-12-28 08:40:18
推荐回答(2个)
回答1:

Regex urlRegex = new Regex(@"(?:^|\?|&)courseid=(\d*)(?:&|$)");
...
...
..

courseId = m.Groups[1].Value;

回答2:

/courseId=(\d+)/