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