Can java.util.regex.Pattern do partial matches?

后端 未结 5 1648
时光取名叫无心
时光取名叫无心 2020-12-01 18:58

Is it possible to know if a stream/string contains an input that could match a regular expression.

For example

 String input=\"AA\";         


        
5条回答
  •  抹茶落季
    2020-12-01 19:44

    If you just want to check if a string contains some pattern specified by a regex:

    String s = ...;
    s.matches( regex )
    

提交回复
热议问题