pain (and stripping whitespace from text)

Steve Davis steven.charles.davis@REDACTED
Sat Mar 13 23:35:09 CET 2010


I've been confounded again by re, trying to strip whitespace from
binary text, as the obvious "[ \t\r\n]+", as in...

list_to_binary(re:replace(<<"a, \tb, \"quoted string\", \n c, d">>,
<<"[ \t\r\n]+">>, <<>>, [global]))

...results in...

<<"a,b,\"quotedstring\",c,d">>.

..I know there must be a regex that would avoid the stripping inside
the quotes, but no amount of experiment (or google) has yielded a
suitable result for me.

Can anybody immediately see a solution (and put me out of my pain)?

Thanks in advance,
/s


More information about the erlang-questions mailing list