提问人:mpreis 提问时间:7/13/2023 最后编辑:InSyncmpreis 更新时间:7/13/2023 访问量:37
正则表达式 - 关于 match 或 matches 方法的最佳实践
regular expressions - best practice with regards to match or matches methods
问:
我正在 VB.net 环境中进行一些正则表达式查询。
基本上我不得不说,我对正则表达式的了解略高于初学者的水平。
我的大多数查询如下所示:
Dim regProj As Regex = New Regex("(?<=\x01)[A-Z]{2}\x02.+?(?=\x03)")
Dim Mtch = regProj.Match(ProjektCodes)
While Mtch.Success
If Mtch.Value.ToUpper.Substring(3) = sTempArr(1).ToUpper Then
ProjektCode = Mtch.Value
Exit While
End If
Mtch = Mtch.NextMatch
End While
我现在的问题是 - 如果我按照示例中所示进行操作,或者如果我使用
Dim MtchColl = regProj.Matches(ProjektCodes)
然后迭代集合?
任何想法都非常受欢迎!
提前致谢
答: 暂无答案
评论