Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: contest problem about shortest Regular expression

by rsFalse (Chaplain)
on Nov 29, 2017 at 10:39 UTC ( [id://1204509]=note: print w/replies, xml ) Need Help??


in reply to Re: contest problem about shortest Regular expression
in thread contest problem about shortest Regular expression

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.
  • Comment on Re^2: contest problem about shortest Regular expression

Replies are listed 'Best First'.
Re^3: contest problem about shortest Regular expression
by choroba (Cardinal) on Nov 29, 2017 at 10:48 UTC
    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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1204509]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-25 07:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found