try this instead
while ( $text =~ m<Name:\s+([[:alpha:] ]+?)\s*Age:\s+(\d+)>g ) {
I changed the \s+Age part to \s*Age, since the space before 'Age' is already consumed by the previous construct, and so it is here not available anymore.
In reply to Re: a regex pattern how to understand
by hexcoder
in thread a regex pattern how to understand
by Thai Heng
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |