From WikiChip
Difference between revisions of "mirc/identifiers/$regml"
(Created page with "{{mirc title|$regml Identifier}}'''$regml''' returns the Nth backreference from a regex match. If you use the /g modifier with an expression containing two backreferences and...") |
m (→Properties: add .group and .match from 7.44) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
== Synopsis == | == Synopsis == | ||
− | <pre>$regml([name], N)</pre> | + | <pre>$regml([name], N, [&binvar])</pre> |
== Parameters == | == Parameters == | ||
* '''name''' - The optional name given to the regex match | * '''name''' - The optional name given to the regex match | ||
* '''N''' - The Nth backreference, if N is 0, returns the total number of backreference/capturing group | * '''N''' - The Nth backreference, if N is 0, returns the total number of backreference/capturing group | ||
+ | * '''&binvar''' - If you pass a binvar as the last parameter, the result is copied to that binvar and $regml() returns the length of the capture | ||
== Properties == | == Properties == | ||
* '''.pos''' - returns the starting position of the backrefence | * '''.pos''' - returns the starting position of the backrefence | ||
+ | * '''.bytepos''' - returns the UTF-8 byte positions matched within a string. | ||
+ | * '''.group''' - returns the () group number for a match | ||
+ | * '''.match''' - returns the match number in the case of a /g global match that returns multiple matches. | ||
== Example == | == Example == |
Latest revision as of 15:17, 28 September 2021
Commands & Identifiers
Basics
Events
Matching Tools
Data Storage
Control Structures
GUI Scripting
Sockets
Advanced Scripting
Additional Resources
Security
Other
$regml returns the Nth backreference from a regex match.
If you use the /g modifier with an expression containing two backreferences and there are three matches, $regml(0) will return 6, it's a list of all backref accross all matches.
Synopsis[edit]
$regml([name], N, [&binvar])
Parameters[edit]
- name - The optional name given to the regex match
- N - The Nth backreference, if N is 0, returns the total number of backreference/capturing group
- &binvar - If you pass a binvar as the last parameter, the result is copied to that binvar and $regml() returns the length of the capture
Properties[edit]
- .pos - returns the starting position of the backrefence
- .bytepos - returns the UTF-8 byte positions matched within a string.
- .group - returns the () group number for a match
- .match - returns the match number in the case of a /g global match that returns multiple matches.
Example[edit]
Compatibility[edit]
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.