我试了过客。好像取不到。你试试这样应该可以!
Dim address As String = "浙江省杭州市某街道118号"
Dim pro As String = String.Empty
Dim city As String = String.Empty
Dim m As Match = Regex.Match(address, "(?<pro>.*?)省(?<city>.*?)市")
If m.Success Then
pro = m.Groups(1).Value
city = m.Groups(2).Value
End If
就是通过序号!
string str = "浙江省杭州市某街道118号";
string pro = string.Empty;
string city = string.Empty;
Match m = Regex.Match(str, @"(?<pro>.*?)省(?<city>.*?)市");
if (m.Success)
{
pro = m.Groups["pro"].Value;
city = m.Groups["city"].Value;
}