Rex

**Rex** stands for: > abbreviated regular expression.

It is the url part of a regular expression designed to match a dropped url - shortened for ease of authoring. The following text:

Rex: www.one-tab.com/page/(.+)

This text must be added to the first item on a page inside a plain text-item will add to the array of global matches. We use an array constructed by simply injecting the sitemap.json using controller_FetchMatchData function.

from the site the tool is on combined by a default library found for now at controller.lviecode.wiki.

It will then be converted to a regular expression as in:

function controller_MatchedItemArray dURL, mData put item 2 of the extents of mData into maxNum repeat with iNum = 1 to maxNum put mData [iNum] into iArray put iArray ["synopsis"] into qLine put rex_FromLine (qLine) into sRex if sRex is empty then next repeat -- checked put rexp_FromRex(sRex) into regExp try if matchText (dURL, regExp) then return iArray end if catch e -- wiki defined regExp is broken end try end repeat return empty end controller_MatchedItemArray

The first check of each item of sitemap.json is to see if the line begins with the magic incantation `Rex:` and if it does to return the second item in the yaml-styled text.

This check is performed by the rex_FromLine handler below:

function rex_FromLine qLine set the itemdelimiter to ":" get word 1 to -1 of item 1 of qLine if it = "Rex" then get word 1 to -1 of item 2 to -1 of qLine return it else return empty end if end rex_FromLine

Next we construct a regular expreession - which by nature is quite ugly due to the number of escqped elements. We us the regExp_FromLinkKey function for that:

function regExp_fromLinkKey linkKey put "\[\[" & linkKey & "\]\]:\s*" into regBit return regBit end regExp_fromLinkKey