in reply to Re^2: REGEX detailed character replace
in thread REGEX detailed character replace

We can also shrink further :)
s/\|/$a++ < 1 ? '':','/eg;s/\s+//g;s/-/$c++ < 3 ? '-' : ','/eg;

Replies are listed 'Best First'.
Re^4: REGEX detailed character replace
by ikegami (Patriarch) on Nov 13, 2008 at 16:05 UTC
    My goal wasn't to golf, but to provide a reasonable solution (as seen by my corruption of the OP's intent of "one line".) I don't think the extra complexity is warranted.