Reputation: 74
Is it possible to replace last separator |
character with space on each row using notepad++ only if the |
is between the name
and secondname
?
I have:
number|surname|name
number|surname|name|secondname
I need:
number|surname|name
number|surname|name secondname
Upvotes: 0
Views: 50
Reputation: 67988
^([^|]*\|[^|]*\|)(?:([^|]*$)|([^|]*)\|([^|]*$))
Try this.Replace by $1$2$3$4
.See demo.
http://regex101.com/r/oE6jJ1/29
Upvotes: 0
Reputation: 71598
Disclaimer: I'm making the assumption that you have a pipe delimited file that you need to 'fix' so that there is a correct amount of columns and that there are 3 columns, with the problem being that the 3rd column can sometimes contain pipe(s).
For that, you can use the regex:
(?:^(?:[^|\n]*\|){2}|(?!^)\G)[^|\n]*\K\|
And replace with space.
Upvotes: 1