From WikiChip
Editing mirc/regex
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help pages.
Latest revision | Your text | ||
Line 12: | Line 12: | ||
* --with-match-limit-recursion - 999 | * --with-match-limit-recursion - 999 | ||
− | The newline sequence | + | The newline sequence is the default $lf, it is the only accepted line separator. |
mIRC has four custom modifiers for regex: | mIRC has four custom modifiers for regex: | ||
Line 23: | Line 23: | ||
<source lang="mIRC"> | <source lang="mIRC"> | ||
− | ;$regexm(input,regex,Nth) | + | ;$regexm(input,regex,Nth) returns the Nth full match |
alias regexm { | alias regexm { | ||
noop $regex(full, $2, /^(?|m(.)?|(/)|^)(.*?)(?:\1(?!.*\1)(.*)$)?$/usD) | noop $regex(full, $2, /^(?|m(.)?|(/)|^)(.*?)(?:\1(?!.*\1)(.*)$)?$/usD) | ||
Line 77: | Line 77: | ||
If the /g modifier is used, that number can be greater than 1. | If the /g modifier is used, that number can be greater than 1. | ||
− | You may see a negative value being returned if an error occured | + | You may see a negative value being returned if an error occured: |
− | |||
− | |||
− | |||
− | |||
* -8 - you reached the maximum number of backtracks allowed, for example: $regex($str(a,4000),(a+a+)*b) | * -8 - you reached the maximum number of backtracks allowed, for example: $regex($str(a,4000),(a+a+)*b) | ||
− | |||
* -21 - you reached an internal recursion limit, for example: $regex($str(a, 1000), (a)+) | * -21 - you reached an internal recursion limit, for example: $regex($str(a, 1000), (a)+) | ||
− | |||
=== $regml === | === $regml === | ||
Line 125: | Line 119: | ||
Special markers can be used inside the <subtext> parameter of $regsubex: | Special markers can be used inside the <subtext> parameter of $regsubex: | ||
− | * \0 - Returns the number of | + | * \0 - Returns the number of matches. |
* \n - Returns the current match number. | * \n - Returns the current match number. | ||
* \t - Returns the current match text (same as $regml(\n)). | * \t - Returns the current match text (same as $regml(\n)). |