in reply to How to strip comments and whitespace from a regex defined with /x?

And don't forget the effects of use re '/x', which means you can't just look at the qualifiers specified on the regex to determine whether blanks are significant. Automating this by looking at a the chunk of Perl containing the regex and figuring out which use re statements are in-scope is also non-trivial.

PPIx::Regexp is an automaton that tries to pull a regex apart and see what makes it tick. It does make an attempt to figure out what is significant and what not, but you have to tell its parser what default qualifiers are in effect. There is no machinery to deparse the regex with insignificant elements removed, but a roll-your-own solution should not be too bad. Disclaimer: I am the author, and have a lively appreciation for the possibility of bugs, especially in the plethora of off-the-beaten-path, edge, and corner cases.