代码之家  ›  专栏  ›  技术社区  ›  iLemming

正则表达式。需要帮助

  •  1
  • iLemming  · 技术社区  · 14 年前

    c:\DevProjects\Web Projects\RD_deploy\obj\Release\Source\App_Code\BusinessLogic\WebMethodTypes\WebCompressionResult.cs(33): error CS0246: The type or namespace name 'CompressionResult' could not be found (are you missing a using directive or an assembly reference?)
    

    c:\DevProjects\AssaultRifle.cs(157): error CS0246: The type or namespace name 'Gunpowder' could not be found (are you missing a using directive or an assembly reference?)
    
    3 回复  |  直到 14 年前
        1
  •  2
  •   krico    14 年前

    尝试:

    ^(.*)\([0-9]+\):.*$
    

    这样就可以了。

        2
  •  2
  •   kevingessner    14 年前

    ^([^\(]+)

    这将得到字符串的开头,直到第一个 ( (33)... .

    编辑: 如果你的文件名中可能有括号,事情会变得更复杂一些。

    ^(.+)(\(\d+\)): 将所有内容匹配到括号中的数字,后跟冒号,如“(33):”或“(157):”,进入组1。

        3
  •  1
  •   Bill the Lizard Alexis MP    11 年前

    ([a-zA-Z]:(?:\\\\\w+(?:\s+\w+)*)+\.\w+)