Changes between Version 12 and Version 13 of RegexIncludeMacro


Ignore:
Timestamp:
Oct 9, 2006, 12:09:17 PM (8 years ago)
Author:
anonymous
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • RegexIncludeMacro

    v12 v13  
    33== Description ==
    44
    5 This is a hack upon the Include macro, that adds regular expression replace functionality.
     5This is a hack upon the Include macro. Features:
     6 * regular expression search
     7 * regular expression replace
     8 * Can include URL's containing logged in users name
     9 * Can choose not to include for anonymous users
    610
    7 Very usable when you whish to extract data from and/or change data inside an included page.
     11Regular expressions are very usable when you whish to extract data from and/or change data inside an included page.[[BR]]
     12Username feature is very usefull for personalized content.
    813
     14'''Note:''' You dont HAVE to use the regular expressions fields. You can still use the other functions as is.
    915
    1016Arguments:
    11  * arg 1 :  url - Like the Include macro except, local files cannot be included[[FootNote(Well, they can if the file resides in /tmp/trac_include/ and no slashes are used in filename.)]]. Also accepts !wiki:MyPage
     17 * arg 1 :  url - '''!http://page.com''' or '''!wiki:WikiPage'''. Local files cannot be included[[FootNote(Well, they can if the file resides in /tmp/trac_include/ and no slashes are used in filename.)]]. Also accepts !wiki:MyPage
    1218 * arg 2 :  format. Either "wiki" or "raw", where wiki does WikiFormatting
    1319 * arg 3+:  "Control arguments". See [wiki:RegexIncludeMacro#ControlArguments Control Arguments] below.
    1420 * arg last:The regular expressions MUST be the last argument
    1521
     22Only arg 1 & 2 are '''required'''.
     23
    1624Regular expressions are defined as such:[[BR]]
     25Search:[[BR]]
     26'expression'[[BR]]
     27''(Remember to define at least one group by using paranthesis)''
     28
     29Replacement:[[BR]]
    1730'<expression>'/'<replacement>'[[BR]]
    1831You can use several expressions:[[BR]]
    1932'<expression>'/'<replacement>','<expression>'/'<replacement>'
     33And search and capture combined[[BR]]
     34'','<expression>'/'<replacement>'
    2035
    2136You can also use capture groups. In python these are defined as \1,\2 ect. (where in eg. perl its $1,$2)
     37
     38The result/output of each expression is passed on to the next expression, from left to right.
    2239
    2340=== Control Arguments ===
     
    4562 '''NOTE:''' this is NOT a security feature, as anyone can still read your source code.[[BR]]
    4663 Good feature to not include unneseseary information for anon users.
     64
     65
     66 match_seperator::
     67 ''Char or string that seperate returned matches from a '''search''' expression''.[[BR]]
     68 Use like this:
     69  * match_seperator=Seperate This
     70  * match_seperator="Seperate This"
     71 Note: To use comma as seperator, it must be quoted. (match_seperator=",")
    4772
    4873