vb.net 正則表達式 取 固定格式的字符:
原始字符串:strSqlTmp=”select * from A_TEST where a_data = '@1@' and b_link = @2@“
当中@包围的是sql文的条件字段,
须要将条件字段取出。单独处理
Dim mc As MatchCollection = Regex.Matches(strSqlTmp, "@([0-9]*?
)@")
For i As Integer = 0 To mc.Count - 1
tableHead.Rows.Add(tableHead.NewRow)
tableHead.Rows(tableHead.Rows.Count - 1).Item("I_FIELD_CODE") = mc.Item(i).Value
tableHead.Rows(tableHead.Rows.Count - 1).Item("I_FIELD_NAME") = ""
tableHead.Rows(tableHead.Rows.Count - 1).Item("I_CONTROL_TYPE") = ""
Next