I am having an issue with string parsing in php. I am trying to create my own template parser (for my learning purpose). I have decided to put urls in the following format {url:abc/def}
so this would be displayed like http://www.domain.com/abc/def. I have tried using str_replace but in this case it would not work since the value after ":" could be anything. Exploding the string also wont work as ":" can also be present in the text of html file. I think this could be only done via regular expression so suggest me some good regular expression also do let me know if this can be achieved via any other approach.
Other things to note.
- Since it is used for template parsing and template can have multiple urls.
- Urls would not have any query strings but i would appreciate if the solution also supports them.