private BasicUrl findUrl ( TextCursor cursor , int limit ) { for ( int i = cursor . currentOffset ; i < limit ; i ++ ) { if ( ! isGoodAnchor ( cursor . text , i - 1 ) ) { continue ; } String currentText = cursor . text . substring ( i , limit ) ; MatcherCompat matcher = Patterns . WEB_URL_START . matcher ( currentText ) ; if ( matcher . hasMatch ( ) ) { String url = matcher . group ( ) ; int start = i + matcher . start ( ) ; return new BasicUrl ( start , start + url . length ( ) ) ; } } return null ; }
Finding non - formatted urls in texts