Dot behavior in regex patterns

前端 未结 4 355
一生所求
一生所求 2021-01-14 18:25
Pattern p2 = Pattern.compile(\".*\");
Matcher m2 = p2.matcher(\"true\");
System.out.println(m2.matches() + \" [\" + m2.group() + \"]\");

When I use

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-14 18:53

    .* means any character 0 or more times [.]* means dot character 0 or more times

提交回复
热议问题