I am working on a simple token replacement function for our product. I almost solved the whole problem, but I missed one thing. A token must support attributes, and an attribute can also be a token. This is part of a larger project. hope you can help.
The start tag is equal "**#[**"
, and the end tag "**]**"
. Let's say # [FirstName], # [LastName], # [Age, WhenZero = "Undisclosed"].
I am using this expression now "\#\[[^\]]+\]"
. It works for me, but it failed on this input:
blah blah text here...
**#[IsFreeShipping, WhenTrue="<img src='/images/fw_freeshipping.gif'/>
<a href='http://www.hellowebsite.net/freeshipping.aspx'>$[FreeShipping]</a>"]**
blah blah text here also...
He fails because he appears first], he stops there. It returns:
*#[IsFreeShipping, WhenTrue="<img src='/images/fw_freeshipping.gif'/>
<a href='http://www.hellowebsite.net/freeshipping.aspx'>$[Product_FreeShipping]*
My desired result should be
*#[IsFreeShipping, WhenTrue="<img src='/images/fw_freeshipping.gif'/>
<a href='http://www.hellowebsite.net/freeshipping.aspx'>$[FreeShipping]</a>"]*
suddenserenity
source
share