(?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 groupingThanks 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
| [reply] |
Matches a string that starts with one or more digits, followed by an "h", "m" or "D" (case sensitive), and then ends.
The (?: ... ) structure in this case doesn't do anything. It might as well have been written:
qr/^\d+[hmD]$/
| [reply] [d/l] [select] |
The Fine Manuals offer lots of clues:
| [reply] |
| [reply] |