This is the format / example of the string I want to get:
<span style='display:block;margin-bottom:3px;'><a style='margin:4px;color:#B82933;font-size:120%' href='/cartelera/pelicula/18312'>EspaΓ±ol </a></span><br><span style='display:block;margin-bottom:3px;'><a style='margin:4px;color:#FBEBC4;font-size:120%' href='/cartelera/pelicula/18313'>Subtitulada </a></span><br> </div>
And this is the regular expression that I use for it:
"pelicula/([0-9]*)'>([\\w\\s]*)</a>"
I checked this regular expression in RegexPlanet and it turned out OK, it gave me the expected result:
group(1) = 18313 group(2) = Subtitulada
But when I try to implement this regular expression in Java, it will not match anything. Here is the code:
Pattern pattern = Pattern.compile("pelicula/([0-9]*)'>([\\w\\s]*)</a>"); Matcher matcher = pattern.matcher(inputLine); while(matcher.find()){ version = matcher.group(2); } }
What is the problem? If the regex has already been tested, and in the same code I'm looking for more patterns, but I have problems with two (I show you only one). Thank you in advance!
_ EDIT __
I found a problem ... If I check the source code of the page, it shows everything, but when I try to use it with Java, it gets another source code. What for? Because this page asks your city so that it can show information about it. I do not know if there is a workaround for this to actually access the information I want, but what is it.
source share