|Version 2 (modified by dfaerch, 7 years ago) (diff)|
NOTE: This Macro is NOT uploaded yet!
This is a hack upon the Include macro, that adds regular expression replace functionality.
Very usable when you whish to extract data from and/or change data inside an included page.
- arg 1 : url -
- arg 2 : format. Either "wiki" or "raw", where wiki does WikiFormatting
- arg 3+: <more to come>
- arg last:The regular expressions MUST be the last argument
Regular expressions are defined as such:
You can use several expressions, seperated by semicolon:
You can also use capture groups. In python (i learned) these are defined as \1,\2 ect. (where in eg. perl its $1,$2)
If you have any issues, create a new ticket.
Download the zipped source from here.
A simple example. Replace all occorences of the word "windows" with the word "Linux"
The next example includes http://www.kernel.org/kdist/finger_banner and wiki-formats the wanted data, and removes the unwanted. Perticulary, i want to only keep the major version information, not patches nor snapshots.
Note how i use 2 regular expression replaces, seperated by ';'. The first expression formats the lines i want to keep, the second deletes the rest.
[[RegexInclude(http://www.kernel.org/kdist/finger_banner,wiki,'The latest ([\w.]+) version [^:]+:\s*([a-z0-9.-]+)',' '''\1''' :: \n ''\2'' ';'\nThe[ a-zA-Z0-9.:-]+','\n')]]
The result is: