0
I have a Regex that removes characters that are not letters or space for a Python application. Ex:
var = re.sub('[^a-zA-Z \\\]', '', "abc Abc aBC cde123 def-ghi $?!123")
Is returning:
abc Abc aBC cde defghi
I need that, besides that, also return everything in tiny:
abc abc abc cde defghi
						
Could [Edit] the question, adding examples of strings and how should the output be? For me it is not very clear what should be returned. Ex: if I have
strs = "abc Abc aBC cde123 def-ghi", what would be the lower case words? I understood thatabcYeah, 'cause it’s all tiny,Abcno, because it starts withA, butaBCstarts with lowercase, she tells?cde123has lowercase letters but tb has numbers, so it doesn’t fit, right? Anddef-ghiis a single word (since this is possible in English, for example), or would be 2 words (defandghi)?– hkotsubo
Hello @hkotsubo I already edited the question, I think it is now clearer my need. Thank you
– c-oliveira
The method
str.lowerwouldn’t be enough for your case? Something likevar.lower()would already return what, apparently, you want.– Woss