问题
I have a file with a some comma separated names and some comma separated account numbers.
Names will always be something like Dow, John and numbers like 012394,19862.
Using Notepad++'s "Regex Find" feature, I'd like to replace commas between numbers with pipes |.
Basically :
turn: Dow,John into: Dow,John
12345,09876 12345|09876
13568,08642 13568|08642
I've been using [0-9], to find the commas, but I can't get it to properly leave the number's last digit and replace just the comma.
Any ideas?
回答1:
Search for ([0-9]), and replace it with \1|. Does that work?
回答2:
use this regex
(\d),(\d)
and replace it with
$1|$2
OR
\1|\2
回答3:
(?<=\d), should work. Oddly enough, this is only working if I use replace all, but not if I use replace single. As an alternative, you can use (\d), and replace with $1|
来源:https://stackoverflow.com/questions/13164312/using-notepad-regex-to-find-and-replace-only-part-of-found-text