论坛的这个代码是识别省市县区的;
但是我的这个具体地址是在一个文本框TextBox1里;
并且识别后,把省赋值到省份列;市赋值到市列
请问老师这个代码该怎么改呢?
Dim str As String = "江苏省南京市秦淮区石头街华泰家园11幢1-205室华宏装饰工程有限公司"
Dim mc = System.Text.RegularExpressions.Regex.Matches(str, ".+(?=省)")
If mc.count = 1 Then
msgbox(mc(0).value)
End If
mc = System.Text.RegularExpressions.Regex.Matches(str, "(?<=省).+(?=市)")
If mc.count = 1 Then
msgbox(mc(0).value)
End If
mc = System.Text.RegularExpressions.Regex.Matches(str, "(?<=市).+(?=区)")
If mc.count = 1 Then
msgbox(mc(0).value)
End If
mc = System.Text.RegularExpressions.Regex.Matches(str, "(?<=室).+")
if mc.count = 1 then
msgbox(mc(0).value)
end if