Parametric reptags too greedy
| Project: | Rep[lacement]Tags |
| Version: | 6.x-1.x-dev |
| Component: | Code / API |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Dear all,
I've created a tag to wrap email addresses into some JavaScript as follows: MAILTO{name,host} is replaced by <script type="text/javascript">var email="%name"+unescape("%40")+"%host"; document.write("<a href='mailto:"+email+"'>"+email+"</a>");</script>.
This works fine until I use the tag several times on the same page. For instance:
1... $MAILTO{user1,host1}$ ...1
2... $MAILTO{user2,host2}$ ...2
3... $MAILTO{user3,host3}$ ...3
4... $MAILTO{user4,host4}$ ...4In the situation, only the first tag is interpreted, its first parameter is set to
user1,host1}$ ...1
2... $MAILTO{user2,host2}$ ...2
3... $MAILTO{user3,host3}$ ...3
4... $MAILTO{user4and its second parameter to host4.
Presumably the regexp that parses the tag is greedy and gets text until the last occurrence of }$ in the page... If this is actually a regexp problem, I would expect that this can be fixed using either a non-greedy .* regexp (like .*? in Perl)or, better, a narrower regexp like [^}$]*... But I'm not good enough with PHP in order to go into the module's code... And unfortunately, I've found no workaround yet...
Thanks for any help!
Franck

#1
Should be solved in the latest -dev version.
#2
Automatically closed -- issue fixed for two weeks with no activity.