For Video Tutorial : Move on Youtube Channel
Note : Select the playlist as per your need & move with number sequence
Regular expression in java with example
Regular expression (regex) is used in java to find a particular patter in an string.
or
Regular expression are used for defining staring patterns that can be used for searching, manipulating and editing a text.
package javapkgn;
import java.util.regex.Pattern;
public class Creg
{
public static void main(String args[])
{
String abc = "hello how are you? hope you are fine";
String def = "(.)you(.)";
boolean isMatch = Pattern.matches(def, abc);
System.out.println("your matches are:" +isMatch);
}
}
your matches are:true
Note: This will search only single occurrence in text for pattern.
No comments:
Post a Comment