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
One way is to process your regexp 'input' so that it replaces for example 'ä' with (ae|ä)' - not hardcode the mappings to your regexps. I am completely ignorant to javascript (ok, i know document.write() but that's about it) - but here is the same in pseudo code;
instead of doing
regexp_match("Grüße|Gruesse",somestring)
You should do something like:
mappings = (("ä","ae"),("ö","oe"),("ü","ue"))
def my_regexp_match(regexp,input) {
for key,value in mappings {
new_regexp = regexp.replace(key,"("+key+"|"+value+")")
}
regexp_match(new_regexp,input)
}
my_regexp_match("Grüße",somestring)
Sorry for being so "pythonic" - I do not know if you have re.compile() -like structure in javascript, but if you do - you should do the for -loop when compiling the matcher, not in my_regexp_match()