Difference between revisions of "$regsubex"

From Scriptwiki
Jump to: navigation, search
 
m
 
Line 24: Line 24:
  
 
[[Category:Regular Expression]]
 
[[Category:Regular Expression]]
 +
[[Category:Identifiers]]

Latest revision as of 00:17, 3 February 2011

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