Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: Generate random strings from regular expression

by bliako (Abbot)
on Jul 08, 2024 at 08:53 UTC ( [id://11160431]=note: print w/replies, xml ) Need Help??


in reply to Re: Generate random strings from regular expression
in thread Generate random strings from regular expression

My searches failed to find Mock::Data::Regex. This module works faultlessly for my use-case. Except that I wasted some time on finding out about the qr//a requirement. Without it, even \d may return a unicode numeral! That's what I call being hit by the unicode bag on the head (re: Re^5: Unicode infinity) hehehe.

Added this solution to the Re: Regexp generating strings?.

Replies are listed 'Best First'.
Re^3: Generate random strings from regular expression
by NERDVANA (Priest) on Jul 08, 2024 at 09:10 UTC
    finding out about the qr//a requirement.

    There's also the max_codepoint option.

    Without it, even \d may return a unicode numeral!

    But! that's because your \d also matches unicode numerals, which might be one of the things you need to test when validating your code works as expected for all possible inputs. People can get a false sense of security by comparing a html form input against /^\d+$/. Likewise, if you end a regex with $ instead of \Z your regex will tolerate a trailing \n, so that is one of the things this module can generate.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2025-07-11 15:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.