Reputation: 9
I have a list of data in this format
0000000000000000|000|000|00000|000000|CITY|GA|123456|8001234567
I need to replace the last piece of data with the word N/A so there is no phone number in the list.
0000000000000000|000|000|00000|000000|CITY|GA|123456|N/A
Thank you for the assistance, much appreciated.
Upvotes: 0
Views: 154
Reputation: 4897
You can use
(?!.*\|)(.+)
to mark the end of the line.
In Notepad++ you can use the search and replace (regex) function.
Upvotes: 0
Reputation: 68
If your phone numbers contain any non-numeric characters (such as periods, hyphens, spaces, etc.), then I would recommend the following adjustment to the regex given by @Bitwise:
(.*)\|(.*)$
Also, in Notepad++, the backreference syntax is not
\1
but rather
$1
which means your replace string will actually be
$1|N/A
Upvotes: 0
Reputation: 336468
The simplest and fastest solution for that would be to search for
[^|\r\n]+$
and replacing all with N/A
.
Explanation:
[^|\r\n]+
matches one or more characters except |
or newlines, and $
makes sure that the match only occurs at the end of a line.
Upvotes: 1
Reputation: 4105
Do a find/replace, with the mode set to "Regular expression".
Find:
(.*)\|[0-9]*
Replace:
\1|N/A
Upvotes: 0