我有這樣的代碼:「?goodid」問號之前字面正則表達式匹配
string source = @"looking for goodid\?=11 and badid\?=01 other text";
string searchTag = @"goodid\?=[\d]*";
while (Regex.IsMatch(source, searchTag))
{
Console.WriteLine("found match!");
}
我試圖找到後到來的ID而不是'badid'後面的那個,所以返回應該是11而不是01.
除非我刪除searchtag中的問號'goodid'前面的文本,否則找不到匹配。我怎樣才能將「goodid」包含在問號旁邊?
@ ser1019042 C#代碼現在增加了:) –