I have a string which have multiple placeholder, for example:
$str = 'Hello [[Name]], Your login id is [[Login]] !!!";
I want to replace all placeholder with some identifier. In above example:
identifier are Name and Login.
The regular expression for this requirment is pretty staightward:
$str =~ s/\[\[([\d\w\-]+)\]\]/$1/g;
Now the problem is there could be Nested Placeholders. For example:
$str = 'Error is: [[[[id]]-[[message]]]]'
so in above example if idenfiers are defined as:
id = 1001
Message = "Crash"
1001-Crash = "System overloaded"
so output of my required regular expression for subsitution should be:
Error is: System overloaded
Any response on this issue will be very helpful.
Thank You.
Ashish Srivastava
__________________________________________________________
Yahoo! India Answers: Share what you know. Learn something new
http://in.answers.yahoo.com/