0
I have a variable that contains the full company name and CNPJ. I am using
verificaCnpj = re.search("\d{2}.\d{3}.\d{3}/\d{4}-\d{2}", variavel)
to locate the CNPJ (because there are other variables that DO NOT CONTAIN CNPJ, and should be discarded).
I want to REPLACE this variable so that it contains ONLY the CNPJ, discarding the company name. What is the best way to do this?
Before the call of
group
it will be necessary to check if the text has the CNPJ, otherwise the functionsearch
will returnNone
.– Woss