in reply to How to cater a self defined escape char in regex ?

I assume you want to return either $name or '(unknown)' including the () from your regex.

$greet =~ s{#\{(\w+)\((\({0,1}\w+\){0,1})\)\}#}{$obj->{"$1"}->($2)}eg;

Replies are listed 'Best First'.
Re^2: How to cater a self defined escape char in regex ?
by exilepanda (Friar) on Apr 08, 2013 at 17:42 UTC
    BIG THANKS! This inspired a lot, I've modified a little with /#\{(\w+)\((.*)\)\}#/ so it fits my needs perfectly! Sorry I might put my question badly.