String matches() method in Java

String matches() method in Java

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

Syntax

Let us see the syntax,

Parameters

Let us see the parameters,

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

Example

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

Output

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 free tutorials for all.

No Comments

Post A Comment