Back to project page MyTwitter-Android.
The source code is released under:
Apache License
If you think the Android project MyTwitter-Android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.fukata.android.mytw.util; //from w ww . j av a 2s. c om import java.util.ArrayList; import java.util.List; import java.util.regex.MatchResult; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * ?????????????????? * * @author smeghead * */ public class StringMatchUtils { static final Pattern URL_PATTERN = Pattern.compile("(https?://)[\\w\\.\\-/:\\#\\?\\=\\&\\;\\%\\~\\+\\@\\,\\_\\!\\*\\(\\)]+", Pattern.MULTILINE | Pattern.DOTALL); /** * ?????????????????URL?List???????? * @param str ??????? * @return URL List */ public static List<String> getUrls(String str) { List<String> urls = new ArrayList<String>(); if (str == null || str.length() == 0) return urls; Matcher m = URL_PATTERN.matcher(str); while (m.find()) { MatchResult mr = m.toMatchResult(); urls.add(str.substring(mr.start(), mr.end())); } return urls; } }