in reply to Recognizing numbers
Yes, but so can YAPE::Regex::Explain.
#!/usr/bin/perl use warnings; use strict; use YAPE::Regex::Explain; print YAPE::Regex::Explain->new('^[0-9]+$')->explain(); print "\n\n"; print YAPE::Regex::Explain->new('^\S{11,}$')->explain(); __END__ The regular expression: (?-imsx:^[0-9]+$) 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): ---------------------------------------------------------------------- ^ the beginning of the string ---------------------------------------------------------------------- [0-9]+ any character of: '0' to '9' (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- $ before an optional \n, and the end of the string ---------------------------------------------------------------------- ) end of grouping ---------------------------------------------------------------------- The regular expression: (?-imsx:^\S{11,}$) 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): ---------------------------------------------------------------------- ^ the beginning of the string ---------------------------------------------------------------------- \S{11,} non-whitespace (all but \n, \r, \t, \f, and " ") (at least 11 times (matching the most amount possible)) ---------------------------------------------------------------------- $ before an optional \n, and the end of the string ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------
-stevieb
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Recognizing numbers
by htmanning (Friar) on Jul 27, 2015 at 23:49 UTC | |
by stevieb (Canon) on Jul 27, 2015 at 23:56 UTC | |
by afoken (Chancellor) on Jul 28, 2015 at 14:25 UTC | |
by 1nickt (Canon) on Jul 29, 2015 at 02:41 UTC |