说我有这个名单(未知分隔符):RegEx - 我应该使用Capture还是Group?
ABC-12345, DEF-34567; WER-12312 \n ERT-23423
我知道正则表达式马赫我需要的是:A-ZÆØÅ] {3} - \ d {5}。但是,如何使用.net匹配类的组或捕获?
这是我第一次尝试:
Public Function ParseSites(ByVal txt As String) As List(Of String)
Const SiteIdRegEx = "([A-ZÆØÅ]{3}-\d{5})"
Dim list As New List(Of String)
Dim result As Match = Regex.Match(txt, SiteIdRegEx)
For Each item As Capture In result.Captures
If (Not String.IsNullOrEmpty(item.Value)) Then
list.Add(item.Value)
End If
Next
Return list
End Function
我想要回我的比赛名单。有任何想法吗?
Larsi
Ahhh ..有一个MatchES功能。谢谢 – Larsi 2010-11-04 11:09:49