[英]Regex - match digits after first three
我有一些數字,例如
;201000129712
;20100054129712
;202343234
;203234234325
;204234325654
我想排除第一個;20x
並匹配其余數字。
到目前為止,這是我的嘗試。
^;20([0-9])
^(;20\d)
^[\;]\d{2}?\d
您接近:
Match match = Regex.Match(input, @"^;\d{3}(\d+)$");
您希望先包含半冒號,然后是三位數字,然后使用向后引用捕獲所有后續數字,直到行尾為止。
或者,如果要批量處理多行字符串:
MatchCollection matches = Regex.Matches(input, @"^;\d{3}(\d+)$");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.