An explanation (beware possible line wrap of intial print of long regex expression):

c:\@Work\Perl\monks>perl -wMstrict -le "use Regexp::Common qw(RE_num_real); use YAPE::Regex::Explain; ;; print YAPE::Regex::Explain->new(RE_num_real(-keep, -group=>3, -sep=>' +,', -base=>2))->explain; " The regular expression: (?-imsx:((?i)([+-]?)((?=[.]?[0123456789])([0123456789]*)(?:([.])([0123 +456789]{0,}))?)(?:([E])(([+-])([0123456789]+))|))) 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 and capture to \1: ---------------------------------------------------------------------- (?i) set flags for this block (case- insensitive) (with ^ and $ matching normally) (with . not matching \n) (matching whitespace and # normally) ---------------------------------------------------------------------- ( group and capture to \2: ---------------------------------------------------------------------- [+-]? any character of: '+', '-' (optional (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \2 ---------------------------------------------------------------------- ( group and capture to \3: ---------------------------------------------------------------------- (?= look ahead to see if there is: ---------------------------------------------------------------------- [.]? any character of: '.' (optional (matching the most amount possible)) ---------------------------------------------------------------------- [0123456789] any character of: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' ---------------------------------------------------------------------- ) end of look-ahead ---------------------------------------------------------------------- ( group and capture to \4: ---------------------------------------------------------------------- [0123456789]* any character of: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' (0 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \4 ---------------------------------------------------------------------- (?: group, but do not capture (optional (matching the most amount possible)): ---------------------------------------------------------------------- ( group and capture to \5: ---------------------------------------------------------------------- [.] any character of: '.' ---------------------------------------------------------------------- ) end of \5 ---------------------------------------------------------------------- ( group and capture to \6: ---------------------------------------------------------------------- [0123456789] any character of: '0', '1', '2', {0,} '3', '4', '5', '6', '7', '8', '9' (at least 0 times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \6 ---------------------------------------------------------------------- )? end of grouping ---------------------------------------------------------------------- ) end of \3 ---------------------------------------------------------------------- (?: group, but do not capture: ---------------------------------------------------------------------- ( group and capture to \7: ---------------------------------------------------------------------- [E] any character of: 'E' ---------------------------------------------------------------------- ) end of \7 ---------------------------------------------------------------------- ( group and capture to \8: ---------------------------------------------------------------------- ( group and capture to \9: ---------------------------------------------------------------------- [+-]? any character of: '+', '-' (optional (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \9 ---------------------------------------------------------------------- ( group and capture to \10: ---------------------------------------------------------------------- [0123456789] any character of: '0', '1', '2', + '3', '4', '5', '6', '7', '8', '9' (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \10 ---------------------------------------------------------------------- ) end of \8 ---------------------------------------------------------------------- | OR ---------------------------------------------------------------------- ) end of grouping ---------------------------------------------------------------------- ) end of \1 ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------
Please also see perlre, perlretut, and perlrequick. There are also a number of on-line regex explainers, but I'm not familiar enough with them to recommend any particular one. (Update: Actually, davido has a nice regex tester which ends up giving a fair amount of explanation, or at least enlightenment. See his personal node for a link)

Update: Caution: YAPE::Regex::Explain only supports regex features added through Perl version 5.6.


Give a man a fish:  <%-{-{-{-<


In reply to Re^3: Using Regexp::Common by AnomalousMonk
in thread Using Regexp::Common by justrajdeep

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.