9

We need to allow the German umlauts for the user to enter as part of user name. While we add

^[A-Za-z0-9äöüÄÖÜß-.]+(?:[._-][A-Za-z0-9äöüÄÖÜß-.]+)*$

This is not working as expected and we just get an error as "Facing Technical difficulty"

  • Have you tried to encode umlets? So use ^[A-Za-z0-9äöüÄÖÜß-.]+...? – Marek Musielak Nov 14 '17 at 8:58
5

I think that your regular expression is not correct. "-" sign in regular expressions is used to match any from range of characters. e.g.: A-Z or a-z. You have range that is not closed: ß- I removed "-" sign and it started to work for me.

^[A-Za-z0-9äöüÄÖÜß.]+(?:[._-][A-Za-z0-9äöüÄÖÜß.]+)*$

Update following comment of @Marek Musielak. It seems that under -. @PVM have meant either . or - characters. In regular expression these characters should be escaped:

^[A-Za-z0-9äöüÄÖÜß\-\.]+(?:[._-][A-Za-z0-9äöüÄÖÜß\-\.]+)*$
  • So there should be \` character before -, right? - should not be removed? – Marek Musielak Nov 14 '17 at 10:57
  • Yes, if @PVM wants to use '-' character then it should be escaped "\-". I was not sure, why this symbol was added, but it definitely causes issue – Anton Nov 14 '17 at 11:31
-2
/^[ A-Za-z\-_.\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF.~\\-]*$/

Please try to use this one.

-5

Try this one.

^[ A-Za-z\u00C0-\u017F.~\\-]*$
  • 1
    Can you add some more details about what you fixed and how it works? – Dan Sinclair Apr 5 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.