forkidssetr.blogg.se

Regex generator
Regex generator











regex generator
  1. Regex generator generator#
  2. Regex generator software#
  3. Regex generator plus#

This software is copyright (c) 2021 by Michael Conrad. If the regular expression is more complicated than a simple charset, this returns undef. If the regular expression is nothing more than a charset (or repetition of one charset) this returns that charset. Parse a regular expression, returning a parse tree describing it.

Regex generator generator#

Return a generator coderef that calls "generate" on this object. The %options may override the following attributes: "min_codepoint", "max_codepoint", "max_repetitions", "prefix", "suffix". Return a string matching the regular expression. METHODS generate my $str= $generator->generate($mockdata, \%options) >new(regex => qr/foo$/m, suffix => '_')->generate # returns "foo\n_"Ī generator or template to add to the end of the output whenever the regex is not anchored at the end. >new(regex => qr/foo$/, suffix => '_')->generate # returns "foo" suffix ->new(regex => qr/foo/, suffix => '_')->generate # returns "foo_" It will be joined to the output with a "\n" if the regex is multi-line and anchored from '^'. >new(regex => qr/^foo/m, prefix => '_')->generate # returns "_\nfoo"Ī generator or template to add to the beginning of the output whenever the regex is not anchored at the start or is multi-line. >new(regex => qr/^foo/, prefix => '_')->generate # returns "foo" prefix ->new(regex => qr/foo/, prefix => '_')->generate # returns "_foo"

Regex generator plus#

Set this to a plain number to specify an absolute maximum, or string with leading plus sign ( "+$n") to specify a maximum relative to the minimum. Whenever a regex has an un-bounded repetition, this determines the upper bound on the random number of repetitions. This is set to 127 automatically if the "regex" has the /a flag. Setting this to a low value (like 127 for ASCII) can speed up the algorithm in many cases. The maximum codepoint to be considered when processing the regular expression or generating strings from it. This only affects selection from character sets literal control characters in the pattern will still be returned. 0x20 to avoid generating control characters. The minimum codepoint to be considered when processing the regular expression or generating strings from it. WARNING: The API of this data structure may change in future versions. regex_parse_treeĪ data structure describing the regular expression.

regex generator

This will always be a regex-ref, even if you gave a string to the constructor.

regex generator

The regular expression this generator is matching. (this module lacks support for several regex features, such as lookaround assertions and backreferences) ATTRIBUTES regex The regular expression must be provided, and it is parsed immediately to check whether it is supported by this module. The constructor can take a key/value list of attributes, hash of attributes, or a single argument which is assumed to be a regular expression.Īny attribute may be supplied in %options. CONSTRUCTOR new my $gen= Mock::Data::Regex->new( $regex_ref ) This generator creates strings that match a user-supplied regular expression. My $mock= Mock::Data->new(generators => ) DESCRIPTION Mock::Data::Regex - Generator that uses a Regex as a template to generate strings SYNOPSIS # Automatically used when you give a Regexp ref to Mock::Data













Regex generator