$regsubex » History » Revision 2
Revision 1 (Per Amundsen, 08/13/2015 10:52 AM) → Revision 2/8 (Per Amundsen, 08/13/2015 10:53 AM)
_Added in 1.9.0_ *$regsubex([name], $regsubex([name], text, re, subtext)* subtext) Performs a regular [[Scripting_Regex|regular expression]] and then performs a substitution using subtext. Returns the substituted text. *Parameters* [name] - Name of the search, which can later be referenced using [[$regml]]. (optional) text - The text to search. re - The [[Scripting_Regex|regular expression]] to perform. subtext - Subtext to replace with. *Subtext* The subtext evaluates identifiers before performing the substitution and special markers can be used to reference various parts of the result. \0 - Returns the number of matches. \n - Returns the current match number. \t - Returns the current match text (same as [[$regml]](\n)). \a - Returns all matching items. \A - Returns a non-spaced version of \a. \1 \2 \N ... - Returns the Nth back-reference made for a given match *Example* <pre> ; Find all lowercase 'a-z' characters and replace them with an uppercase character. //echo -ag $regsubex(abcdefg,/([a-z])/g,$upper(\1)) </pre>