Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex ant中的正则表达式否定_Regex_Ant_Regex Negation_Regex Greedy - Fatal编程技术网

Regex ant中的正则表达式否定

Regex ant中的正则表达式否定,regex,ant,regex-negation,regex-greedy,Regex,Ant,Regex Negation,Regex Greedy,我正在尝试计算文件中不包含以下行的行数: /*================================================= */ 或 或 空行 我能够计算包含LIB的行数 <propertyregex property="noOfUsers" input="@{line}" regexp="Number of current users:\s*([0-9]+)$" select

我正在尝试计算文件中不包含以下行的行数:

/*================================================= */

或 空行

我能够计算包含
LIB
的行数

<propertyregex property="noOfUsers"
               input="@{line}"
               regexp="Number of current users:\s*([0-9]+)$"
               select="\1" />

但是,我无法推导出否定表达式。有人能帮我弄一下这个正则表达式吗

  • 这是查找注释行的模式,例如
    /*anything*/
    。在您的语言中使用下面的模式,通过循环可以找到注释行的数量

    模式:
    /^[/][*].[*][/]$/

  • 要查找空行,可以使用下面的模式

    模式:
    /^\n/

  • 谢谢,
    Arun

    请参阅此答案以了解解决方案=>可能的重复
    <propertyregex property="noOfUsers"
                   input="@{line}"
                   regexp="Number of current users:\s*([0-9]+)$"
                   select="\1" />