Fix wrong HTML pattern regular expressions

Transform the ruby REs from rails validations to REs that conform more
with the ECMA-262 standard, escpecially anchoring with ^ and $ instead
of \A and \z, \Z. Otherwise they won't be understood by browsers
implementing the HTML5 specs.