Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: Reverse engineering regular expressions

by bsb (Priest)
on Aug 01, 2005 at 12:47 UTC ( #479876=note: print w/replies, xml ) Need Help??

in reply to Reverse engineering regular expressions

Generating regex strings with a regex

Or with Rexexp::Genex:

perl -MRegexp::Genex=:all -le 'print for strings(qr/(.*)test(.*)/)' 3'e3''test 3'e3'test~ 3'e3'test 3'e3test ╠ 3'e3test  3'e3test 3'etest 3'etest 3'etest 3'etest 3'test╠e  3'test╠e 3'test╠e 3'test╠ 3'test 3test~ 3test test

Replies are listed 'Best First'.
Re^2: Reverse engineering regular expressions
by davido (Cardinal) on Aug 01, 2005 at 15:08 UTC

    But what has that gotten you? At best, a contrived minimal slice of an infinite set. Where, for example, is "asdf;laksjfd;alksjaewraefsdtest134qwefalskdfjaeraf;" (another minimal slice of infinity).


      I didn't have time to wait for that one. :)

      You are right, of course. However, sometimes a slice of an infinite set is enough, say for testing or debugging. Also, regexes with only small characater classes and finite quantifiers do produce useful and complete results.

      Dominus' book gives you an infinite stream of the matching strings, ordered by length. Still quite a wait in your case.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2021-03-01 04:57 GMT
Find Nodes?
    Voting Booth?

    No recent polls found