in reply to Tell or determine whichever Perl regex group fails

There exists GraphViz::Regex which visualises a regex as a graph.

My idea was to visualise what happens to that graph when an input string is run against the regex. And then find unvisited or failed nodes. Sorry, that's a rough sketch. Whatever the way, I don't know how to do that. BUT! there is re_graph.pl which claims to not only visualise a regex but also visualise it when run against some input, see the example parsing perl comments. The author is Steve Oualline. Unfortunately I did not manage to get that example to work.

Update: along the lines of the above rough sketch I found (again I think?) this online regex visualiser https://blog.robertelder.org/regular-expression-visualizer/ which shows that it is visible. Anonymous Monk has a way to conveniently extract all the info from running the regex against some input: Re: Tell or determine whichever Perl regex group fails

bw, bliako

  • Comment on Re: Tell or determine whichever Perl regex group fails

Replies are listed 'Best First'.
Re^2: Tell or determine whichever Perl regex group fails
by etj (Priest) on Jan 04, 2022 at 18:17 UTC
        You wouldn't extend this module, because it does what it's supposed to. What you're describing would be achieved by getting the graph object back, then mutating it with further inputs from somewhere, like the regex debugger mentioned elsewhere here.