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 thatabc
Yeah, 'cause it’s all tiny,Abc
no, because it starts withA
, butaBC
starts with lowercase, she tells?cde123
has lowercase letters but tb has numbers, so it doesn’t fit, right? Anddef-ghi
is a single word (since this is possible in English, for example), or would be 2 words (def
andghi
)?– hkotsubo
Hello @hkotsubo I already edited the question, I think it is now clearer my need. Thank you
– c-oliveira
The method
str.lower
wouldn’t be enough for your case? Something likevar.lower()
would already return what, apparently, you want.– Woss