in reply to validate a form field with regexp?

See also Params::Validate, FormValidator::Simple, other validators

Regexp::English

use Regexp::English; print Regexp::English ->new ->beginning_of_string ->literal('SR') ->digit ->digit ->digit ->digit ->digit ->digit ->digit ->end_of_string, "\n"; __END__ (?^:\ASR\d\d\d\d\d\d\d\Z)

YAPE::Regex::Explain

use YAPE::Regex::Explain; print YAPE::Regex::Explain->new( qr{(?:\ASR\d\d\d\d\d\d\d\Z)} )->explain; __END__ The regular expression: (?-imsx:(?:\ASR\d\d\d\d\d\d\d\Z)) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?-imsx: group, but do not capture (case-sensitive) (with ^ and $ matching normally) (with . not matching \n) (matching whitespace and # normally): ---------------------------------------------------------------------- (?: group, but do not capture: ---------------------------------------------------------------------- \A the beginning of the string ---------------------------------------------------------------------- SR 'SR' ---------------------------------------------------------------------- \d digits (0-9) ---------------------------------------------------------------------- \d digits (0-9) ---------------------------------------------------------------------- \d digits (0-9) ---------------------------------------------------------------------- \d digits (0-9) ---------------------------------------------------------------------- \d digits (0-9) ---------------------------------------------------------------------- \d digits (0-9) ---------------------------------------------------------------------- \d digits (0-9) ---------------------------------------------------------------------- \Z before an optional \n, and the end of the string ---------------------------------------------------------------------- ) end of grouping ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------

Replies are listed 'Best First'.
Re^2: validate a form field with regexp?
by chromatic (Archbishop) on Apr 21, 2012 at 08:00 UTC

      You're the first person I've seen use Regexp::English!

      I think it a nice crutch for newbies :) something I can copy/paste that newbies can run with

      FWIW, it needs patching, beginning is laborious to write, start man, start :)

        FWIW, it needs patching...

        I'll happily take patches or even give up some or all maintainership.