How to find if a Java String contains X or Y and contains Z

前端 未结 8 1982
孤街浪徒
孤街浪徒 2021-01-06 11:03

I\'m pretty sure regular expressions are the way to go, but my head hurts whenever I try to work out the specific regular expression.

What regular expression do I ne

8条回答
  •  感动是毒
    2021-01-06 11:43

    With multiple .* constucts the parser will invoke thousands of "back off and retry" trial matches.

    Never use .* at the beginning or in the middle of a RegEx pattern.

提交回复
热议问题