Combine two regexes

后端 未结 2 1985
孤独总比滥情好
孤独总比滥情好 2021-01-20 20:43

I have two regular expressions which are working perfectly fine when use independently.

First  : ^.+\\.((jpeg)|(gif)|(png))\\s*$ : search for .jpeg,gif or p         


        
2条回答
  •  面向向阳花
    2021-01-20 21:16

    The spaces in your combined expression are erroneous. You are requiring a space after end of line or before beginning of line, which is impossible in line-oriented input.

    As a further improvement, you can remove the superfluous "anything" parts of the match, as well as a good number of redundant parentheses.

    javax\.faces\.resource|rfRes|\.(jpeg|gif|png)\s*$
    

    Notice also the proper quoting of literal full stop characters (a lone . matches any character).

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题