I need to find a regular expression which pulls out a value from a table cell in a html doc.
Example contents of this table cell are “Result: 40 mins”.
I need a regular expression to match the actual number (40).
This is in java, thanks in advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’ve tried to do this with regular expressions before, and it is a pain in the hole.
It is MUCH easier to use something like an XPath expression, where you can specify the location by its place in the DOM hierarchy. The Apache libraries can do this (specifically Xalan) wihich can be found here: http://xml.apache.org/xalan-j/
You can use the Firefox addon XPath Checker to help you out with this.
The area you’re talking about is called “web scraping” by the way, if you’re looking for other tools/information.