The C# code you've provided uses C#'s Verbatim string syntax, which doesn't require escaping of backslashes. To convert it to a normal string literal, which would be the same in C# and JavaScript, you can remove the @
symbol at the front and then escape backslashes by adding another backslash before them:
"^([0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z-])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{2,9})$"
To use this as a JavaScript Regex, you pass it to the RegExp constructor:
let emailRegularExpression = new RegExp("^([0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z-])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{2,9})$");
Or, even better, you can just use JavaScript's literal regex syntax (without escaping backslashes:
let emailRegularExpression = /^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z-])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$/;
This works as specified for the cases you've specified:
emailRegularExpression.test("adasd457@sdjf45.idie")
: true
emailRegularExpression.test("ex-sdf@sadf.co333")
: false
emailRegularExpression.test("j²coolio@sadf.co333")
: false (special character)