[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
- what is the regular expression that matches nothing?, Randy Yates, 2004/12/23
- Re: what is the regular expression that matches nothing? -- I think it is the null expression. When I do "egrep '' somefile" the result is the same as when I do "cat somefile". The result of "egrep -v '' somefile" is, as expected, nothing. HTH, me, 2004/12/23
- Re: what is the regular expression that matches nothing? -- I think it is the null expression. When I do "egrep '' somefile" the result is the same as when I do "cat somefile". The result of "egrep -v '' somefile" is, as expected, nothing. HTH, Randy Yates, 2004/12/23
- Re: what is the regular expression that matches nothing?, me, 2004/12/23
- Re: what is the regular expression that matches nothing? -- I think it is the null expression. When I do "egrep '' somefile" the result is the same as when I do "cat somefile". The result of "egrep -v '' somefile" is, as expected, nothing. HTH, Stan Brown, 2004/12/23
- Re: what is the regular expression that matches nothing? -- I think it is the null expression. When I do "egrep '' somefile" the result is the same as when I do "cat somefile". The result of "egrep -v '' somefile" is, as expected, nothing. HTH, Randy Yates, 2004/12/24
- Re: what is the regular expression that matches nothing? -- I think it is the null expression. When I do "egrep '' somefile" the result is the same as when I do "cat somefile". The result of "egrep -v '' somefile" is, as expected, nothing. HTH, Andrei Voropaev, 2004/12/27
Re: what is the regular expression that matches nothing?,
Paul Jarc <=