Clark, can you point me to the section of the standard which defines that ] must be the first characters in []? It feels not common sense, unsymmetrical and sounds like a nightmare for parsers. I believed that every character with a special meaning for extended regex must be escaped in cases where the user wants the character literally. Does the standard really define an exception here?
Olga 2012/2/24 Clark J. Wang <[email protected]>: > 2012/2/24 ольга крыжановская <[email protected]> >> >> David, the extended regular expression ~(E)[\]] does not match the >> string "]", i.e. ksh -c 'x="]" ; [[ $x == ~(E)[\]] ]] && print match'. >> Is this a mistake on my side or a bug in libast regex? > > > I think that's a quoting problem. To match a literal ] in brackets, ] must > be the first char in [] and it does not need to be escaped. But without the > \ ksh will report syntax error. If we put the RE in a var then it'll work > fine: > > # re='~(E)[]]' > # [[ ']' == $re ]] && print match > match > # >> >> >> Olga >> -- >> , _ _ , >> { \/`o;====- Olga Kryzhanovska -====;o`\/ } >> .----'-/`-/ [email protected] \-`\-'----. >> `'-..-| / http://twitter.com/fleyta \ |-..-'` >> /\/\ Solaris/BSD//C/C++ programmer /\/\ >> `--` `--` >> _______________________________________________ >> ast-users mailing list >> [email protected] >> https://mailman.research.att.com/mailman/listinfo/ast-users > > -- , _ _ , { \/`o;====- Olga Kryzhanovska -====;o`\/ } .----'-/`-/ [email protected] \-`\-'----. `'-..-| / http://twitter.com/fleyta \ |-..-'` /\/\ Solaris/BSD//C/C++ programmer /\/\ `--` `--` _______________________________________________ ast-users mailing list [email protected] https://mailman.research.att.com/mailman/listinfo/ast-users
