I use the following with respect to letters from any language:
text = regex.sub("[^\p{alpha}\d]+"," ",text
Can I use p{alpha}
to convert letters to their lower case equivalent if such an equivalency exists? How would this regex look?
To use a keyboard shortcut to change between lowercase, UPPERCASE, and Capitalize Each Word, select the text and press SHIFT + F3 until the case you want is applied.
The toLowerCase() method converts a string to lower case letters.
Program to convert the uppercase string into lowercase using the strlwr() function. Strlwr() function: The strlwr() function is a predefined function of the string library used to convert the uppercase string into the lowercase by passing the given string as an argument to return the lowercase string.
>>> re.sub('[AEIOU]+', lambda m: m.group(0).lower(), 'SOME TEXT HERE')
'SoMe TeXT HeRe'
As oxtopus suggested, you can simply convert letters to their lowercase version with text.lower()
(no need for a regular expression). This works with Unicode strings too (À -> à, etc.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With