Hi,
I'trying to use a regExp in Javascript to replace any all upper case word in a string by the same word having only its first letter in upper case.
This expression detects the words:
/([A-ZÄÀÉÈÊËÎÏÔÙÛÜ])([A-ZÄÀÉÈÊËÎÏÔÙÛÜ]+)/g
and backreferences $1 and $2 will contain the first letter and the rest of the word respectively.
Now, how can I convert $2 to lower case in the replace function?
I would need something like:
replace(/([A-ZÄÀÉÈÊËÎÏÔÙÛÜ])([A-ZÄÀÉÈÊËÎÏÔÙÛÜ]+)/g, "$1" + "$2".toLowerCase())
But this does not work since the toLowerCase() is applied first to the string "$2", THEN the string $2 is replaced by the second match.