Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

O(m * n) lookaround #1152

Copy link
Copy link

Description

@rpjohnst
Issue body actions

A 2024 POPL paper proposed a new NFA-based algorithm for matching regular expressions with arbitrary lookaround in O(m * n) time, without the previously-required exponential blowup in automaton size or matching time: https://dl.acm.org/doi/10.1145/3632934

Its main limitation is that, for regular expressions with both lookahead and lookbehind, it no longer supports streaming, because each form of lookaround involves a pass from its associated direction, and an O(n) buffer to hold the results. (With only one or the other, everything can be done in one pass and without the buffer.)

They show some pretty competitive benchmarks with PCRE2 and Java's regex engine as well.

I don't personally have a way to judge how worthwhile this would be, but I thought you would be interested to hear about it in any case!

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.