I have problems using a url-checker regex to match twitters picture urls.
The url looks like this:
String twitterPictureURL = "pic.twitter.com/123abc";
My regex looks like this:
String regex = "^(?:http(s)?:\\/\\/)?\\[\\w.-\\]+(?:\\.\\[\\w\\.-\\]+)+\\[\\w\\-\\._~:/?#\\[\\\\]@!\\$&'\\(\\)\\*\\+,;=.\\]+$";
The regex works if i try it online but when i use it in my code it does not work anymore.
I use it like this:
Pattern pattern = Pattern.compile(regex);
if(pattern.matcher(twitterPictureUrl).matches())
{
//match
}
else
{
//no match
}