in reply to contest problem about shortest Regular expression

See chapter 6.5 Regex String Generation in Higher Order Perl, the book by Mark Jason Dominus.
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: contest problem about shortest Regular expression
by rsFalse (Chaplain) on Nov 29, 2017 at 10:39 UTC
    Thank you for this resource, haven't read this book so far. In 6.5 chapter I found explanations how to generate string stream - to generate all strings which are covered by given regex, nice explaning schemes included. So it looks as an opposite problem.
      Ouch, you're right. I misread the assignment, I had the impression it wants the strings. OK, so you just want to optimize a finite automaton generated by joining all the input strings by | :-)

      ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
        Yes, and I still don't know how to optimize (to shorten) such long regex to the minimal. And have no clear idea.