String matches() method in Java

The boolean matches(String regex) method in Java tells whether or not this string matches the given regular expression.


Let us see the syntax,


Let us see the parameters,

  • regex − the regular expression with which the string is matched


The following is an example of matches(String regex),


The following is the output,

Java String matches method

String length() method in Java
String regionMatches(boolean ignoreCase, int toffset, String other, int ooffset, int len) method in Java
Studyopedia Editorial Staff
Studyopedia Editorial Staff
[email protected]

We work to create programming tutorials for all.

No Comments

Post A Comment

Discover more from Studyopedia

Subscribe now to keep reading and get access to the full archive.

Continue reading