in reply to Re^2: How do I extract named variable names from regex string
in thread How do I extract named variable names from regex string
All that's required is for the pattern to match. Taking the pattern, and wrapping it inside a (?: )? will make it match against "" (except for some degenerate cases). If you look back at my code, this is exactly what I did."" =~ /(?:(?<mon>\w+)\s(?<mon>\w+))?/; say scalar keys %-; # 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: How do I extract named variable names from regex string
by LanX (Saint) on Jan 31, 2012 at 03:47 UTC |