2013-12-10 53 views

回答

1

您可以使用正则表达式来单独编号

Regex.Replace("AB24", "(?:[0-9]+\.?[0-9]*|\.[0-9]+)", "") 

您可以使用正则表达式来单独文本

Regex.Replace("AB24", "[^\A-Z]", "") 
+0

感谢。我使用Regex.Replace(“AB24”,“\ d + $”,“”),它的工作完美。 – samithagun

0

,你可以简单地使用lastNo = Regex.Match(txtNextLot.Text, "/^[A-z]+$/").Value

+0

我试过了。但是这只返回一个空字符串。 – samithagun

2

使用捕获组()来分隔你的比赛。

Dim m As Match = Regex.Match("AB24", "^([A-Z]+)([0-9]+)$") 

If (m.Success) Then 
    Console.WriteLine(m.Groups(1).Value) 
    Console.WriteLine(m.Groups(2).Value) 
End If 

输出

AB 
24 
+0

感谢您的回复。 – samithagun