Dim txt As String = "+ 1.2990g"
Dim pattern As String = "+(.*?)g"
Dim str = System.Text.RegularExpressions.Regex.Matches(txt, pattern, "")
Output.Show(str)
请问要提取+与g之间的所有字符,提示错误,请问如何修改?
Dim txt As String = "+ 1.2990g"
Dim pattern As String = "(?<=\+).*?(?=g)"
Dim rgx = New System.Text.RegularExpressions.Regex(pattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase)
For Each match As System.Text.RegularExpressions.Match In rgx.Matches(txt)
Output.Show(match.Value)
Next