From WikiChip
$regsub Identifier - mIRC
< mirc‎ | identifiers
Revision as of 19:55, 25 February 2018 by Ouims (talk | contribs) (Created page with "{{mirc title|$regsub Identifier}}'''$regsub''' performs a regular expression match and then substitute/replace, returns the number of match found and store the result in a %va...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

$regsub performs a regular expression match and then substitute/replace, returns the number of match found and store the result in a %var or &binvar, more information about regex in mIRC here


Synopsis

$regsub([name],input,regex,subtext,%var|&binvar)

Parameters

  • name - The optional name of the regex, to be used later to retrieve captured group with $regml or $regmlex
  • input - The input text
  • regex - The regular expression for PCRE
  • subtext - the text to use to replace the match, you cannot use $regml or $regmlex inside the subtext parameter nor you can use \1 etc, for that you need to use $regsubex

Properties

None

Example

//var %a | echo -a $regsub(abcd,/[a-z]/g,1,%a)

Compatibility

Added: mIRC v5.9
Added on: 26 Apr 2001
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.


See Also