/**
*/
protected function _getValidationPattern()
{
static $pattern = '';
if (!empty($pattern)) {
return $pattern;
}
/* Get current locale information. */
$linfo = Horde_Nls::getLocaleInfo();
/* Build the pattern. */
$pattern = '(-)?';
/* Only check thousands separators if locale has any. */
if (!empty($linfo['mon_thousands_sep'])) {
/* Regex to check for correct thousands separators (if any). */
$pattern .= '((\\d+)|((\\d{0,3}?)([' . $linfo['mon_thousands_sep'] . ']\\d{3})*?))';
} else {
/* No locale thousands separator, check for only digits. */
$pattern .= '(\\d+)';
}
/* If no decimal point specified default to dot. */
if (empty($linfo['mon_decimal_point'])) {
$linfo['mon_decimal_point'] = '.';
}
/* Regex to check for correct decimals (if any). */
if (empty($this->_fraction)) {
$fraction = '*';
} else {
$fraction = '{0,' . $this->_fraction . '}';
}
$pattern .= '([' . $linfo['mon_decimal_point'] . '](\\d' . $fraction . '))?';
/* Put together the whole regex pattern. */
$pattern = '/^' . $pattern . '$/';
return $pattern;
}