I'm trying to create a regex that is able to find a string in a text even though there is some white space in the middle of the words. For example, I search the text for the following excerpts
"impaired conciliation" or even "irreconcilable"
But since everything is not always beautiful there may be some lost space in the middle of words, for example:
"with impaired ciliation" or "i n c o cated"
I did as follows:
padrao = re.search(r'i\s*n\s*c\s*o\s*n\s*c\s*i\s*l\s*i\s*a\s*d\s*o\s*s|'
r'c\s*o\s*n\s*c\s*i\s*l\s*i\s*a\s*ç\s*ã\s*o\s*(p\s*r\s*e\s*j\s*u\s*d\s*i\s*c\s*a\s*d\s*a|r\s*e\s*j\s*e\s*i\s*t\s*a\s*d\s*a)', text)
My question is .. is there a less ugly and gigantic way of ignoring these spaces?