Reputation: 373
I need to parse a string which contains custom tags like [link][description][link-url][/link]
and I want to convert it to <a href="link-url">description</a>
.
Any help on this is highly appreciated.
Upvotes: 0
Views: 478
Reputation: 67075
Here is the regex you could use:
\[link\]\[(.*)\]\[(.*)\]\[\/link\]
Then you can use the regex replace:
<a href="$2">$1</a>
Upvotes: 2