[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: efficient regular expression that never matches
From: |
cinsk |
Subject: |
Re: efficient regular expression that never matches |
Date: |
Fri, 20 Nov 2015 21:52:43 -0800 (PST) |
User-agent: |
G2/1.0 |
On Saturday, November 21, 2015 at 12:59:51 AM UTC+9, John Wiegley wrote:
> >>>>> Stefan Monnier <monnier at iro.umontreal.ca> writes:
>
> >> I'm thinking of "$a", but it should scan all the string until end of the
> >> string, so it may not be efficient.
>
> > IIRC I used something like "\\`\\'a".
>
> Yes, also because "$" only has special meaning as the last character of the
> regexp, whereas \\' should always mean "end of <context>".
>
> John
Yes, I agree with that,
However, "$a" means that the regular expression engine may read all strings
until the end of the line. So, if I can do something like "^<SOME CHARACTER OR
CONDITION IMPOSSIBLE>", then the engine should detect before reading all
characters of the line, I presume. Perhaps "^\uFFFFF" can be a solution?
Since \uFFFF is noncharacter of the unicode (\uFFFF can be use for the internal
purpose but generally not used.)