Difference between revisions of "Issue:Asking a parser "replace " demo"
From FollowTheScore
Roc michael (talk | contribs) |
|||
Line 40: | Line 40: | ||
== Reply == | == Reply == | ||
+ | |||
+ | <nowiki> | ||
+ | * {{#replace:{{{1}}}|/^([^{{!}}]+\{{!}}){1}([^\]]+).*/|\2}} | ||
+ | * {{#replace:{{{1}}}|/^([^:]+:){1}([^{{!}}]+).*/|\2}} | ||
+ | </nowiki> | ||
+ | Putthe above code into a template and you will see that the user ID and the user name will be extracted. |
Revision as of 10:54, 22 December 2007
Description: | Asking a parser "{{#replace: [[User:Michael|Roc Michael]] | from | to }}" demo |
Extension / Version: | DPL / all |
Type / Status: | Change Request / open |
Problem
Hi Gero.
Could you give me the samples on using parser "replace" (or using other way) with following cases. for exapmle {{#replace: [[User:Michael|Roc Michael]] | from | to }}
Item | From (Before) | To (After) |
---|---|---|
Case 1 | [[User:Michael|Roc Michael]] and |
Roc Michael and 張小三 |
Case 2 | [[User:Michael|Roc Michael]] and |
Michael and 張三 |
Please give me a hand.--Roc michael 02:33, 20 December 2007 (CET)
Reply
* {{#replace:{{{1}}}|/^([^{{!}}]+\{{!}}){1}([^\]]+).*/|\2}} * {{#replace:{{{1}}}|/^([^:]+:){1}([^{{!}}]+).*/|\2}} Putthe above code into a template and you will see that the user ID and the user name will be extracted.