A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/travisdowns/polyregex/issues/1 below:

Don't create new substates for captures that aren't referenced by a backref · Issue #1 · travisdowns/polyregex · GitHub

In principle we only need to "record" (i.e., create new subNFA graphs) for captures that are actually used by some later backreference. I.e., in (.)(.)(.)\1\3 we currently record all three groups but only 1 and 3 are actually used. In principle it could be written with 2 as a non-capturing group like (.)(?:.)(.)\1\2 but we don't want to rely on the user for that.

Since number of unique backreferences is limited (to nine, i.e. \1 through \9), but the number of capture groups is unlimited, the behavior is important since if limited the captures based on found backreferences we can claim we are in P regardless of the regex.

This is as simple as scanning the regex after parsing and limiting the captures to those with at least one corresponding backreference.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4