[Top][All Lists]

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

Re: Unquoted special characters in regexps

From: martin rudalics
Subject: Re: Unquoted special characters in regexps
Date: Fri, 03 Mar 2006 19:52:39 +0100
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

> To give a less technical answer than in my previous response, an
> _unquoted_ ", followed by a bunch non-newline whitespace or commas.

(string-match "[^\\]\\(\\([\\][\\]\\)*\\)\"[ \t,]*" "\" ,") => nil

> What is the point you are trying to make?  That
> "[^\\]\\(\\(\\\\\\\\\\)*\\)\"[ \t,]*"
> would be easier to read?  Not for me.

I agree that writing and reading 10 backslashes in a row is dreadful.
However, writing `[\\]' to match a single backslash is dreadful as well.
A character alternative without alternative does not deserve its name.
Nowadays I'd probably write something like

"[^\\]\\(\\\\\\{2\\}*\\)\"[ \t,]*"

but maybe at the time the original expression was written repetition
operators were not yet available.

Anyway, the "point I was trying to make" was a different one.  I believe
we should give suggestions how to avoid writing confusing regexps rather
than change `regexp-quote'.

reply via email to

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