I’m developing an android application and I want to recognise links that are inside a EditText. I have the next code that works in objective-c and I want to do it in java. I guess that will be do with a vector (string links[]), but I don’t know.
NSError *qwerror = nil;
NSRegularExpression *qwregex = [NSRegularExpression regularExpressionWithPattern:@"(http://\\w+.\\w+.\\w+.\\w+.\\w+.)" options:0 error:&qwerror];
NSArray *qwmatches = [qwregex matchesInString:textView.text options:0 range:NSMakeRange(0, textView.text.length)];
NSMutableArray *qwwords = [NSMutableArray array];
for (NSTextCheckingResult *qwmatch in qwmatches) {
NSRange qwwordrange = [qwmatch rangeAtIndex:1];
NSString *qwword = [textView.text substringWithRange:qwwordrange];
[qwwords addObject:qwword];
}
NSString *allLinks = [qwwords componentsJoinedByString:@" "];
This may work: