Improve regex check as suggested by @arlolra

https://github.com/cryptocat/cryptocat/commit/9aef609d3dcc7fd4c20c5e7d53
fdbd76d57eabe7#commitcomment-6650111