import java.util.regex.Matcher; import java.util.regex.Pattern; public class Lookbehind1 { public static void main(String[] args) throws Exception { String regex = "(?<=http://www.)\\S+"; Pattern p = Pattern.compile(regex); String url = "The url of the roseindia is "; url += "http://www.roseindia.net. Rohini"; System.out.println(url); Matcher m = p.matcher(url); while (m.find()) { String msg = "Name of the company is : " + m.group(); System.out.println(msg); } } }