Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: Removing special chars from line

by graff (Chancellor)
on Oct 19, 2011 at 01:44 UTC ( [id://932272]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Removing special chars from line
in thread Removing special chars from line

It looks like the stream of characters that you want to remove are all cases of "backspace" (expressed as a four-character sequence 'esc [ 1 D', but with the 'esc' character transliterated by your terminal window display into two printable characters: "^" and "[" ), followed by one of:  / - \ |

It's the ascii-art version of the rotating clock-hand. To get rid of that specific pattern, use a regex substitution -- I think it would go something like this (not tested):

s{ (?: \e \[ 1 D [\\/|-] )+ }{}gx;
The "\e" represents the escape character, the open-square-bracket needs to be preceded by backslash to be treated as a literal character, and the four "rotating hand" characters are in a character class that follows "D" (the hyphen needs to be either last or first in the class list, to avoid being interpreted as a range operator, and the backslash needs to be escaped, but "|" does not (and neither does "/", since I'm not using that as the regex delimiter).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-19 05:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found