I have the following text:
DiretorioXmlImpressao=C:\\Program Files (x86)\\TESTE\\XmlImpressao\\08187168000160\\
I would like to select all but the CNPJ(14-character sentence at the end of the text), and so I tried the following regular expression:
DiretorioXmlImpressao=[^0-9]+
Returned:
DiretorioXmlImpressao=C:\\Program Files (x
but I expected: 08187168000160
Sorry guys, i have a few experience with regex, I just don't express myself very well.
I want in fact do this return:
DiretorioXmlImpressao=C:\\Program Files (x)\\TESTE\\XmlImpressao\\
cause i want just only the 14-character and the \, for i can use in this replace. This is working execept when have numbers in the path like that"x86".
regexp_replace(teste,'DiretorioXmlImpressao=[^0-9]+',E'DiretorioXmlImpressao=P:\\TESTE\\XmlImpressao\\','ig');
the final expect result of my regex and replace is this below
DiretorioXmlImpressao=P:\\TESTE\\XmlImpressao\\08187168000160\\
Thanks!
I haven't found a tasteful way to do this without a match group.
select all but the 14-character sentence at the end of the text
means this to me (well, with the final backslashes added, as I'm assuming you'd want):
/^(.*)[0-9]{14}\\$/
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