Looking for a regular expression to work on a list of comma separated values
You can simply replace the middle number of each line with nothing.
In the editor
That is, in your editor, search-and-replace the regex
,[0-9]+,
(which only matches numbers with commas on both sides, which for your input is just the middle number) with a single comma:
,
I assume Ultraedit supports regex search-and-replace. If not, try Notepad++, which I know does.
From the command line
Since you tagged your question shell-script, here's how to do it from the command-line.
sed
Use sed
, a standard Linux command also available for Windows as part of Cygwin or GnuWin32:
C:\>sed -e 's/,[0-9]+,/,/g' filename.txt
Powershell
Jens pointed out that you can also do it in Windows Powershell; see this explanation.
Regex syntax varies from application to application. I am unfamiliar with Ultredit and will give a generaql anser
Your regex lacks capturing parentheses
([0-9]+),[0-9]+,([0-9]+)
In order to replace text, one needs to tag the proper sub-expression using parentheses.
In UltraEdit, you must search for the following regular expression:
%^([0-9]+^),[0-9]+,^([0-9]+^)