This Example describes the way to split the String after each character using
expression. For this we are going to make program named SplittingFind. java. The steps
involved in program SplittingFind.java are described below:
String regex = ("\\w.+"):- Creating expression for text. Here
"\\w" means to match any alphanumeric character.
Pattern p = Pattern.compile(regex):- Creating a pattern object and
compiles the given regular expression into a pattern.
Matcher m = p.matcher(text):- Creates a matcher for matching the given
input against pattern p.
m.find():- This is the method of matcher class which is used for
finding the next subsequence of the input sequence and it usually returns a
boolean value.
m.group():- It returns the input sequence match with the first match.