I tried to move the _-: characters in front of [:alnum:], but without success: echo "hello name=\"value\" world" | grep -b --strict -E "((?:[_-:[:alnum:]]+='[^']*?'))" | cat grep: regular expression: invalid [...] range endpoint echo "hello name=\"value\" world" | grep -b --strict -E "((?:[_-\:[:alnum:]]+='[^']*?'))" | cat grep: regular expression: invalid [...] range endpoint
Olga On Sun, Jun 24, 2012 at 3:34 AM, Glenn Fowler <[email protected]> wrote: > > a valid [...] range has the lower value char on the left and higher value > character on the right > > On Sun, 24 Jun 2012 03:15:45 +0200 =?KOI8-R?B?z8zYx8Egy9LZ1sHOz9fTy8HR?= > wrote: >> The egrep expression below fails because : in a range [...] is not quoted: >> echo "hello name=\"value\" world" | grep -b --strict -E >> "((?:[[:alnum:]_-:]+=\"[^\"]*?\"))" | cat >> grep: regular expression: invalid [...] range endpoint > >> Now, how to I fix that? Adding \'s does not work: >> echo "hello name=\"value\" world" | grep -b --strict -E >> "((?:[[:alnum:]_-\:]+=\"[^\"]*?\"))" | cat >> grep: regular expression: invalid [...] range endpoint > >> echo "hello name=\"value\" world" | grep -b --strict -E >> "((?:[[:alnum:]_-\\:]+=\"[^\"]*?\"))" | cat >> grep: regular expression: invalid [...] range endpoint > >> echo "hello name=\"value\" world" | grep -b --strict -E >> "((?:[[:alnum:]_-\\\:]+=\"[^\"]*?\"))" | cat >> grep: regular expression: invalid [...] range endpoint > >> echo "hello name=\"value\" world" | grep -b --strict -E >> "((?:[[:alnum:]_-\\\\:]+=\"[^\"]*?\"))" | cat >> grep: regular expression: invalid [...] range endpoint > >> Olga > >> P.S.: Glenn, thank you for grep --strict and sed --strict. I wish ksh >> had an option to print such diagnostics for shell and extended regular >> expressions. >> -- >> , _ _ , >> { \/`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
