c# regex matches example

后端 未结 6 2118
耶瑟儿~
耶瑟儿~ 2020-12-01 11:46

I am trying to get values from the following text. How can this be done with Regex?

Input

Lorem ipsum dolor sit %download%#456 amet, consect

6条回答
  •  伪装坚强ぢ
    2020-12-01 12:06

    This pattern should work:

    #\d
    
    foreach(var match in System.Text.RegularExpressions.RegEx.Matches(input, "#\d"))
    {
        Console.WriteLine(match.Value);
    }
    

    (I'm not in front of Visual Studio, but even if that doesn't compile as-is, it should be close enough to tweak into something that works).

提交回复
热议问题