I have a tax file that comes with the following information on the line:
To fix it I have to delete a part, and the right thing would be:
So I started doing a regular expression in notepad++; In which I can find exactly what I want to look for. The expression is this:
Now I need to know how to replace them all so that the value I expect is generated:
The idea is to look for the pattern you want to remove. As I understand you want to remove the
|12 at the end of the text, that is, the pattern you are looking for is
My expression is based on the following:
\|look for a slash, escape is needed because slash in
\d+shortcut to search for numbers in a greedy way.
$border that looks for the end of a string.
let texto = 'OCF|DINHEIRO|160.12|12'; let expressao = /\|\d+$/; console.log(texto.replace(texto.match(expressao),''));