* @param id HTML element id
* @param regex expected regex
* @throws Exception
*/
private void checkTextRegex(WebResponse resp,String id,String regex) throws Exception {
HTMLElement element = resp.getElementWithID(id);
assertNotNull(element);
Pattern pattern = Pattern.compile(regex);
// strip new lines from string to be tested
String text = element.getText().replace("\n","");
Matcher matcher = pattern.matcher(text);
if (!matcher.matches())
{
fail(element.getText()+" did not match "+regex);
}
}