I have a list of URL like this one:
http://mysite.es/img/p/3/6/2/5/6/36256.jpg
I need to replace the 36256 part.
My regular expression looks like this:
Boolean find = Pattern.matches("^[http://].+/(?<number>\\d+)[\\.jpg]$", url);
But it's always returning false. What i am doing wrong? I think the problem is that there are many "/" on the URL but not all the URLs have the same number of /.
This works:
Boolean find = Pattern.matches("[\\.jpg]$", url);
This doens't works:
Boolean find = Pattern.matches("/(\\d+)[\\.jpg]$", url);
I can't figure out why.
Thanks in advance