Variants of String matches() Method

There exist multiple variants three variants of the matches() method, as listed and described below, as follows: 

  1. String matches() Method
  2. String regionMatches()
  3. String regionMatches() with ignoreCase

String matches() Method in Java with Examples

Variants of matches() method is used to tell more precisely not test whether the given string matches to a regular expression or not as whenever this method is called in itself as matches() or be it matches() where here we do pass two arguments that are our string and regular expression, the working and output remains same.

Similar Reads

Variants of String matches() Method

There exist multiple variants three variants of the matches() method, as listed and described below, as follows:...

1. String matches() Method

This method tells whether or not this string matches the given regular expression. An invocation of this method of the form str.matches(regex) yields exactly the same result as the expression Pattern.matches(regex, str)....

2. String regionMatches() Method

...

3. String regionMatches() with ignoreCase

...