Replaced javascript with HTML5 pattern attribute