$regsubex

From Scriptwiki
Revision as of 00:17, 3 February 2011 by Vliedel (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Performs a regular expression match, like $regex, and then performs a substitution using subtext.

$regsubex([name], text, re, subtext)

Subtext is evaluated during substitution and can be an identifier.

Subtext can also contain special markers where

  • \0 = number of matches
  • \n = match number
  • \t = match text
  • \a = all match items
  • \A = a non-spaced version of \a

Returns text result.

Example

$regsubex(<p style="font-size: 18px;">Example text.</p>,/<[^>]+>/g,)

The above regular expression can be used to strip any HTML tags using $regsubex, returning the stripped text.

See Also