in reply to Regular expression

  (?x:                     group, but do not capture (disregarding
                           whitespace and comments) (case-sensitive)
                           (with ^ and $ matching normally) (with .
                           not matching \n):
----------------------------------------------------------------------
    ^                        the beginning of the string
----------------------------------------------------------------------
    (?:                      group, but do not capture:
----------------------------------------------------------------------
      \d+                      digits (0-9) (1 or more times
                               (matching the most amount possible))
----------------------------------------------------------------------
      hmD                    any character of: 'h', 'm', 'D'
----------------------------------------------------------------------
    )                        end of grouping
----------------------------------------------------------------------
    $                        before an optional \n, and the end of
                             the string
----------------------------------------------------------------------
  )                        end of grouping
Thanks to YAPE::Regex::Explain

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics

Replies are listed 'Best First'.
Re^2: Regular expression
by akagrawal3 (Beadle) on Mar 04, 2012 at 08:39 UTC
    Thank you CountZero :)