<b>Renewal Date:</b> 03 May 2010</td>
DateStr = /<b>Renewal Date:</b>(.+?)</td>/.exec(returnedHTMLPage);
I tried to follow some tutorials on
java.util.regex.Matcher with no luck. I can’t seem to be able to translate (.+?) into something they can understand??
This is how regular expressions are used in Java:
Pattern p = Pattern.compile("<b>Renewal Date:</b>(.+?)</td>"); Matcher m = p.matcher(returnedHTMLPage); if (m.find()) // find the next match (and "generate the groups") System.out.println(m.group(1)); // prints whatever the .+? expression matched.
There are other useful methods in the Matcher class, such as
m.matches(). Have a look at Matcher.