Im using validates_format_of method to check email format:
validates_format_of :email, :with => /^([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})$/i
I've written a small gem that translates Ruby regexes to JavaScript:
https://github.com/janosch-x/js_regex
It can handle more cases than the gsub approach, and includes warnings if any incompatibilities remain.
Note that, whatever you do, not all Ruby regexes can be fully translated to JS, because Ruby's regex engine has a lot of features that JavaScript's doesn't have.