in reply to How regexes fail.

You may want to look at Matching in huge files, which uses a sliding window technique to match in large files.

Replies are listed 'Best First'.
Re^2: How regexes fail.
by ikegami (Patriarch) on Feb 25, 2008 at 21:15 UTC

    A sliding window is useless, since a lexer needs to match at the end of the last found token. However, the linked snippet could be modified to *expand* it's window instead of sliding it.

Re^2: How regexes fail.
by jdoege (Acolyte) on Feb 25, 2008 at 21:26 UTC
    I look at that and do not see that it differentiates between regex failure modes. That is, I think I see in the code that if a regex fails, it simply gets more data for the window and trys again. I would only want this to happen if the regex failed only by reaching the end of the window. Otherwise, a lexer should try a different token pattern to match.

    Or am I missing something?