This allows you to attach a name to a backreference like (?<name>pattern) that can be used within the match as \g{name} and anywhere else (in the replace or outside of the regex) as part of the hash %+. Keep in mind though, just because its a shiny new feature doesn't mean you have to use it. First figure out if its the best tool for the job :)$date = '8/1/2008'; $date =~ s!(?<month>\d{1,2})/(?<day>\d{1,2})/(?<year>\d{4})!$+{year}-$ ++{month}-$+{day}!;
Disclaimer: Of course, the example above is a quick and dirty example, and as such should never be used. It was only meant to illustrate the feature noted.
Update: Ah, perhaps I did misunderstand the original question after all.
__________
Systems development is like banging your head against a wall...
It's usually very painful, but if you're persistent, you'll get through it.
In reply to Re^2: Using variables in RegEx
by EvanK
in thread Using variables in RegEx
by hsfrey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |