Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Detecting 'binary' in a variable

by dbwiz (Curate)
on Jul 05, 2005 at 18:19 UTC ( #472556=note: print w/replies, xml ) Need Help??


in reply to Re: Detecting 'binary' in a variable
in thread Detecting 'binary' in a variable

Not always

$ perl -le '{local$/; $_=<>;}print /^[\x00-\xA5]/ ? "binary" : "text" +' \ /mnt/win/WINDOWS/system32/command.com text

Replies are listed 'Best First'.
Re^3: Detecting 'binary' in a variable
by Transient (Hermit) on Jul 05, 2005 at 18:23 UTC
    That's correct, but that's not the same regexp:

    /^[\x00-\xA5]/
    ne
    /[^\x00-\xA5]/

      Sorry. My fault.

      But then, again, any text with accented vowels (à,è etc., in Italian, French, Spanish) will look like binary.

        \xA5 = 165 which should match just about everything except Greek (as per the OP's specs). Unicode not considered either.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2023-09-27 08:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?