On Tue, Apr 19, 2011 at 5:15 PM, Guido Berhoerster
<[email protected]> wrote:
> why do regex backslash sequences not work inside a charcter
> class?
> E.g.
> [[ "123" == ~(E)[\d] ]] && print match
> does not match, in Perl it does, ie.
> perl -e '"123" =~ /[\d]/ && print "match\n"'
> matches as expected.

Erm... it seems to work for ast-ksh.2011-02-08 for both egrep and perl
regex mode:
-- snip --
$./build_normal/arch/linux.i386/bin/ksh -c '[[ "123" == ~(E)[\d] ]] &&
print match'
match
$ ./build_normal/arch/linux.i386/bin/ksh -c '[[ "123" == ~(P)[\d] ]]
&& print match'
match
-- snip --

Note that perl5 uses a traditional NFA engine (this should be
~(P)pattern) while ksh93 uses a POSIX NFA engine (e.g. ~(E)pattern)...
there are subtle differences like that a traditional NFA engine
matches the first match in an "or" expression like (a|aaa) while POSIX
NFA engines always match the longest match (libast's perl regex mode
doesn't do this... erm... Glenn ?).

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [email protected]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)

_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to