[Tutor] Regex question

"Andrés Chandía" andres at chandia.net
Sun Apr 3 14:17:21 CEST 2011


I continue working with RegExp, but I have reached a point for wich I can't find
documentation, maybe there is no possible way to do it, any way I throw the question:

This is my code:

    contents = re.sub(r'Á',
"A", contents)
    contents = re.sub(r'á', "a",
contents)
    contents = re.sub(r'É', "E", contents)
    contents = re.sub(r'é', "e", contents)
    contents = re.sub(r'Í', "I", contents)
    contents = re.sub(r'í', "i", contents)
    contents = re.sub(r'Ó', "O", contents)
    contents = re.sub(r'ó', "o", contents)
    contents = re.sub(r'Ú', "U", contents)
    contents = re.sub(r'ú', "u", contents)

It is
clear that I need to convert any accented vowel into the same not accented vowel,
The
qestion is : is there a way to say that whenever you find an accented character this
one
has to change into a non accented character, but not every character, it must be only
this vowels and accented this way, because at the language I am working with, there are
letters
like ü, and ñ that should remain the same.

thanks you
all.

_______________________
            andrés
chandía

P No imprima
innecesariamente. ¡Cuide el medio ambiente!




More information about the Tutor mailing list