Dan Muey wrote:
> 
> Howdy,

Hello,

> perldoc perlre on 5.8.0 says that [:ascii:] should match any ascii
> character and [:^ascii:] is the negate version.
> 
> If I do =~m/[:^ascii:]/ or [:ascii:] on astring that is 'hi' it

That character class matches the characters 'a', 'c', 'i', 's', ':' or
'^' and 'hi' contains the character 'i' so it returns true.


> returns true each way, so I believe it says the [] are part of
> [::] conbstruct which I think means you have to have[[:class:]]

Yes.


> Now [^[:ascii:]] and [[:ascii:]] behave as you'd expect so I think
> that's all correct ( Please tell me if I'm wrong)
> 
> SO my question is:
> 
> Which is faster/better/more portable/compliant etc....
> 
> [^[:ascii:] or [[:^ascii:]] ??

$ perl -le'use re qw/debug/; "xxx" =~ /[[:^ascii:]]/g'
Compiling REx `[[:^ascii:]]'
size 11 first at 1
   1: ANYOF[-\377](11)
  10: END(0)
stclass `ANYOF[-\377]' minlen 1 
Matching REx `[[:^ascii:]]' against `xxx'
Freeing REx: `[[:^ascii:]]'

$ perl -le'use re qw/debug/; "xxx" =~ /[^[:ascii:]]/g'
Compiling REx `[^[:ascii:]]'
size 11 first at 1
   1: ANYOF[-\377](11)
  10: END(0)
stclass `ANYOF[-\377]' minlen 1 
Matching REx `[^[:ascii:]]' against `xxx'
Freeing REx: `[^[:ascii:]]'


They both look the same to me.


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to