in reply to a regex pattern how to understand
The [[:alpha:] ] matches alphabetic characters plus a space character
Correct,
so I think "\s+Age:" should match one or more space and "Age:"
correct,
There is only one space between name and age.
and correct. And the code you show produces the output you show.
If you want to understand what the regex is doing, you can look at the gory details of how Perl handles it by adding use re 'debug'; at the top of your code. Or, have a look at https://regex101.com/r/pP4dN2/1
Otherwise, I don't understand what exactly you are asking?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: a regex pattern how to understand
by Thai Heng (Beadle) on Jul 08, 2015 at 22:54 UTC | |
by Anonymous Monk on Jul 08, 2015 at 23:11 UTC | |
by Anonymous Monk on Jul 08, 2015 at 23:26 UTC |