Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Efficiently create an IF/ELSE regex

by jeffa (Bishop)
on May 01, 2015 at 15:51 UTC ( [id://1125370]=note: print w/replies, xml ) Need Help??


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)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1125370]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (6)
As of 2024-04-16 06:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found