[wplug] simple regex
Duncan Hutty
duncan at hutty.com
Thu Jun 26 14:34:40 EDT 2003
> To which Bob Schmertz now responds:
>
> In this context, it *is* <NOT>. But the reason it doesn't work as you
> expected is because it means "show me lines which contain at least one
> character which is not '@'. Thus the line
>
> @@@@@@@@@@@@@t@@@@@@@@@@@
>
> would match because the 't' matches the 'not a @' requirement.
>
> Another thing you could do would be
>
> grep '^[^@]*$'
>
> which would mean "the whole line should consist of characters which are
> not @". But grep -v is easier, especially when you want to exclude more
> complex things.
>
> --
> Cheers,
> Bob Schmertz
>
Since the regex is required for an address in a sed command, I opted for the '^[^@]*$' approach, but james is correct that grep -v '@' matches as intended.
Thanks all, for your comments.
--
Duncan Hutty
More information about the wplug
mailing list