help-gnu-utils
[Top][All Lists]
Advanced

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

Re: what is the regular expression that matches nothing?


From: Paul Jarc
Subject: Re: what is the regular expression that matches nothing?
Date: Mon, 27 Dec 2004 10:26:21 -0500
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux)

If "^" matches only at the beginning of the candidate string (or if it
can match after a newline, but your strings do not contain newlines),
then ".^" might work.  (Or might not, if your regexp engine treats "^"
specially only when it occurs at the beginning of the regexp.)
Similar comments for "$.".

If your regexp engine has lookahead, then (Perl syntax) "(?=a)b" would
work: "(?=a)" matches an empty string if it is followed by "a"
(without consuming the "a"), but then the whole regexp matches only if
that is followed by "b".  "a" and "b" can't both appear in the same
location, so this always fails.


paul




reply via email to

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