-2
我有一个RegEx我在vb.net中使用,我可以获得文本的所有匹配,但我想要获得文本的第一个匹配项,这是我正在使用的。如何使用vb.net中的正则表达式从文本中获得第一个匹配
文字::1283 xxxxxxxxxx :1288 :9879
正则表达式::[0-9]+
如何我刚刚得到的第一场比赛(:1283
)?
我使用的代码是:
Dim MRIDRegex As New Regex(":[0-9]+")
Dim count As Integer = 0
Dim mrid As String = String.Empty
For Each item As Match In MRIDRegex.Matches(message)
count += 1
If count = 1 Then
mrid = item.Value
End If
Next
你能提供你试过的代码吗? – FakeRainBrigand
@FakeRainBrigand即时通讯使用一个在线vb.net正则表达式测试人 – redoc01
人们需要解释他们为什么拒绝投票这个问题??????? – redoc01