[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: regexp: anything but |

lee wrote:

On Wed, Dec 09, 2009 at 06:07:34PM +0000, Chris Jackson wrote:

To match anything except |, use:


Thanks! That's nice, but the pattern '\^.*\|[^\|]-[0-9]\|' still
matches all lines ... and I don't see why/how it could to that
... Hmm. Here's an example line:


<start of line> <anything> <pipe> <anything but pipe> -[-0] <pipe>
should match above line. But why does it match


If you're in sed:


If you aren't using extended regular expressions (sed -r), pipe is not special. Also don't escape ^ ;)

Note that from the shell this is in single quote marks to stop shell expansions. Doing it without those would be masochism ;)

Chris Jackson

Reply to: