This Example describes the way to retrieve the String after giving expression.For this we are going to make program named Lookbehind.java. The steps involved in program Lookbehind.java are described below:-:-
String regex = "(?<=http://www.)\\S+":-Here
we have given the expression in the String form.Let us describe each
character is used to match either one orzero times.
<=:- By this we mean
String after "http://www.".
meaning of this expression is to print rest of the string after the
Pattern p =
Pattern.compile(regex):-Creating a pattern object and compiles the
given regular expression into a pattern.
m = p.matcher(url):-Creates a matcher for matching the given input
against pattern p.