Regex for Umlaut

前端 未结 5 1769
没有蜡笔的小新
没有蜡笔的小新 2020-11-30 05:56

I am using JS Animated Contact Form with this line of validation regex:

rx:{\".name\":{rx:/^[a-zA-Z\'][a-zA-Z-\' ]+[a-zA-Z\']?$/,target:\'input\'}, other fie         


        
5条回答
  •  广开言路
    2020-11-30 06:37

    Try using this:

    /^[\u00C0-\u017Fa-zA-Z'][\u00C0-\u017Fa-zA-Z-' ]+[\u00C0-\u017Fa-zA-Z']?$/
    

    I have added the unicode range \u00C0-\u017F to the start of each of the square bracket groups.

    Given that /^[\u00C0-\u017FA-Za-z]+$/.test("aeiouçéüß") returns true, I expect it should work.

    Credit to https://stackoverflow.com/a/11550799/940252.

提交回复
热议问题