On 1/21/14 9:37 PM, Jeff Anderson wrote:
It looks like a lone ^ by itself in a character class is a syntax error:

$ echo '^^^^^^^' | pcregrep '[^]'
pcregrep: Error in command-line regex at offset 3: missing terminating ]
for character class

What's happening here is that the ^ just negates whatever's inside the brackets, so it doesn't count as a character. The right bracket ] has to be the first character inside the brackets if you want it to be one of the characters (unless it's escaped), so in this case it's counting the ] as a character inside the brackets, not as the ending bracket.

Which explains the error message.

Steve


/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to