M
mnml
Hi, I made a little function to extract urls from any content with a
regular expression but it doesn't really work.
when i try to extract urls from http://google.com i only get 4 results
in my array:
* http://images.google.nl/imghp?oe=ISO-8859-1&hl=nl&tab=wi
* http://
* .nl
* /imghp?oe=ISO-8859-1&hl=nl&tab=wi
Here is the code of my function:
public static void find_url(String content) {
Pattern p = Pattern.compile("(@)?(http://)?[a-zA-Z_0-9\\-]+(\\.\\w[a-
zA-Z_0-9\\-]+)+(/[#&\\n\\-=?\\+\\%/\\.\\w]+)?");
Matcher m = p.matcher(content);
if (m.find())
{
for (int i=0; i<=m.groupCount(); i++) {
myVar.urls = m.group(i);
}
}
}
regular expression but it doesn't really work.
when i try to extract urls from http://google.com i only get 4 results
in my array:
* http://images.google.nl/imghp?oe=ISO-8859-1&hl=nl&tab=wi
* http://
* .nl
* /imghp?oe=ISO-8859-1&hl=nl&tab=wi
Here is the code of my function:
public static void find_url(String content) {
Pattern p = Pattern.compile("(@)?(http://)?[a-zA-Z_0-9\\-]+(\\.\\w[a-
zA-Z_0-9\\-]+)+(/[#&\\n\\-=?\\+\\%/\\.\\w]+)?");
Matcher m = p.matcher(content);
if (m.find())
{
for (int i=0; i<=m.groupCount(); i++) {
myVar.urls = m.group(i);
}
}
}