Regex syntax modified for rails4

See http://stackoverflow.com/a/21072723/414642