VB.net 正则表达式 获取信息

发布于 2024-09-04 08:56:35 字数 585 浏览 15 评论 0原文

好吧,我目前正在尝试在这两件事之间获取单词/文本

:和!

我试过了,

        Dim nick As String = String.Empty
        Dim p = ":(?<ircnick>.*?)!"
        Dim Matches = Regex.Matches(mail, p, RegexOptions.IgnoreCase Or RegexOptions.Singleline)
        If Matches IsNot Nothing AndAlso Matches.Count > 0 Then
            For Each Match As Match In Matches
                If Match.Groups("info").Success Then
                    nick = (Match.Groups("ircnick").Value)
                End If
            Next
        End If

它不显示任何内容。如果你们能为我修复这段代码,我会很高兴:D。

Well I am currently trying to get the word/text in between these 2 things

: and !

I tried this

        Dim nick As String = String.Empty
        Dim p = ":(?<ircnick>.*?)!"
        Dim Matches = Regex.Matches(mail, p, RegexOptions.IgnoreCase Or RegexOptions.Singleline)
        If Matches IsNot Nothing AndAlso Matches.Count > 0 Then
            For Each Match As Match In Matches
                If Match.Groups("info").Success Then
                    nick = (Match.Groups("ircnick").Value)
                End If
            Next
        End If

It doesn't display anything. If you guys can fix this code for me I would be happy :D.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

红焚 2024-09-11 08:56:35

根据 本教程: 和 < code>! 是保留字。你尝试过逃离他们吗?

According to this tutorial, both : and ! are reserved words. Did you try escaping them?.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文