Skip to content

Creating a DFA for regex with backreferences if the strings are of finite and known length #1247

Answered by BurntSushi
asasine asked this question in Q&A
Discussion options

You must be logged in to vote

so could a DFA be constructed?

If you can translate the regex with backreferences to an actual regular expressing, then, yes, of course, you could generate a DFA.

But if you're talking about a regex with over a million different branches, then good luck. It probably won't go over well. And note that this crate has a limit on the total number of states in a DFA that it can generate (based on how many states can be represented in ~32 bits). That limit might seem constraining, but in practice, a DFA that big is going to take a very very long time to generate and generally be completely unwieldy to actually use.

However, I don't see any APIs for DFA that allow retrieving the states directl…

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@asasine
Comment options

Answer selected by asasine
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@asasine
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants