The problem is those non-ASCII characters in your test address, ÖßÜÄÖ
(which you only ever mentioned in a comment to @HansKesting's answer). In .NET, \w
matches all Unicode letters and digits, and even several characters besides _
that are classified as connecting punctuation, but in JavaScript it only matches [A-Za-z0-9_]
.
JavaScript also lacks support for Unicode properties (like \p{L}
for letters) and blocks (\p{IsLatin}
), so you would have to list any non-ASCII characters you want to allow by their Unicode escapes (\uXXXX
). If you just want to support Latin1 letters, I suppose you could use [\w\u00C0-\u00FF]
, but IDN is supposed to support more than just Latin1, isn't it?
By the way, JavaScript also doesn't support Singleline mode, and even if it did you wouldn't be able to use it. JS does support Multiline and IgnoreCase modes, but there's no way to set them on both the server and client side. The inline modifiers, (?i)
and (?m)
, don't work in JS, and the RegexOptions argument only works server-side.
Fortunately, you don't really need Singleline mode anyway; it allows the .
metacharacter to match linefeeds, but the only dots in your regex are matching literal dots.