I'd put the last hyphen from those sets as the first character:
Before:
[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]
After:
[-A-Za-z0-9!#$%&'*+/=?^_`{|}~]
The hyphen will allow a range of characters. It will be treated as hyphen if it is the first character of the set. Else, it could mean "from '~' until ']'"
But still, it's hard to answer precisely without a precise question.
EDIT:
I've tested this expression on a simple JavaScript RegEx tester, and I discovered it is meant to match e-mail addresses. It worked for me after I replaced the double-backslashes \\
by single ones \
.
In JavaScript, the following two should work the same:
var re = /a\.c/;
var re = new RegExp("a\\.c");
But the second one requires double back-slashes because it is enclosed in a string, which requires escaping. If all else fails, check Mozilla Developer Center.
But, again, it's impossible to give a precise answer without a precise question. What's more, when you try to improve your question, it's more likely that you will find your bug.