Description
This method tells whether the string matches the given regular expression. Form Str.matches (regex) The invocation of this method produces exactly the same result as the expression pattern.matches (Regex, str). Grammar
The syntax defined by this method is as follows:
Public boolean matches (String regex)
Parameters
Here is the details of the parameter:
Regex--Regular expressions are matched to this string. return Value:
If this method returns True, if and only if the regular expression specified by the string matches. Example:
Import java.io.*;
public class test{public
static void main (string args[]) {
string Str = new String (' Welcome to tutorialsyiibai.com ");
System.out.print ("Return Value:");
System.out.println (Str.matches ("(. *) Tutorials (. *)"));
System.out.print ("Return Value:");
System.out.println (Str.matches ("tutorials"));
System.out.print ("Return Value:");
System.out.println (Str.matches ("Welcome (. *)"));
}
This will produce the following results:
Return value:true return
Value:false
Return value:true
===========================================================
Used in Hadoop.
Quality = 1
Quality.matches ("[01459]")
Returns True