[Top][All Lists]

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

Re: :alnum: broken?

From: Mattias Engdegård
Subject: Re: :alnum: broken?
Date: Sun, 23 Feb 2020 11:21:58 +0100

22 feb. 2020 kl. 02.09 skrev Paul Eggert <address@hidden>:

> That is, GNU grep treats a bracket expression like '[:space:]' as an error, 
> since it's inevitably a typo. (POSIX does not allow this behavior so the 
> diagnostic is suppressed if POSIXLY_CORRECT is set.)

Such a check is obviously unsound, strictly speaking, which may be a reason for 
objecting to it. But in practice? It would have to be naïve regexp-building 
code that puts characters inside square brackets without eliminating 
duplicates, like

(defun make-char-regexp (char-list)
  (concat "[" (apply #'string char-list) "]"))

and given our experience in regexp mistakes, such code probably exists in use 
somewhere. I'm still in favour of the check since it would be cheap and 
helpful, and false positives unlikely. It is a fairly infrequent blunder, 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]