I have a
string that may contain a combination of urls and other information. All urls begin with
http:// and if they separated by a blank if the string contains multiple items for example
String re = "test
http://x.ca/abc/abcsurvey.studytaker.login this is
test " +
"http://a.ca/abc/abcsurvey.adminteamweb.login my name is michael " +
"http://b.ca/abc/abcsurvey.localadmin.login ";
I would like to obtain it in this order
1/test
2/http://x.ca/abc/abcsurvey.studytaker.login
3/this is test
4/http://a.ca/abc/abcsurvey.adminteamweb.login
5/my name is michael
6/http://b.ca/abc/abcsurvey.localadmin.login
Pattern pattern = Pattern.compile("http://[^ ]+|.*? (?=http
");
Matcher matcher = pattern.matcher(s);
while(matcher.find()) {
System.out.println(matcher.group());
This works for some cases however I cannot get it to work for
String a = "test"
or
String b = "http://b.ca test";
or
String c = "test
http://c.ca test";
Thank you all for your time. Sorry if I didnt post this in the right forum