Regex to compare strings with Umlaut and non-Umlaut variations

后端 未结 7 1801
刺人心
刺人心 2021-01-13 10:34

Can anyone help me with a javascript regular expression that I can use to compare strings that are the same, taking into acccount their non-Umlaut-ed versions.

for e

7条回答
  •  我在风中等你
    2021-01-13 11:00

    In addition to stereofrogs answer:

    tr = {"\u00e4":"ae", "\u00fc":"ue", "\u00f6":"oe", "\u00df":"ss" }
    
    ersetzeUmlauts = function(s) {
        return s.replace(/[\u00e4|\u00fc|\u00f6|\u00df]/g, function($0) { return tr[$0] })
    }
    

    I was dealing with Umlauts in an Aptana/Eclipse script and the normal characters ('ä' etc.) didn't do the trick for me.

提交回复
热议问题