in reply to Efficiently create an IF/ELSE regex

So what you are saying is that instead of receiving 'AD\thomas' you are receiving 'AD    homas' and you want to reverse construct the original string? Why are you receiving garbage data? Garbage in/garbage out ... but in the off chance that yes, this is the hand you have been dealt then this should do the trick:

my @incoming = ( "AD\thomas", "MAIN\nancy", "FOO\randy", "nancy", ); s/\t/\\t/ for @incoming; s/\n/\\n/ for @incoming; s/\r/\\r/ for @incoming; print $_, $/ for @incoming;
I'll leave it to someone else to condense that into one neat regex. ;)

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)