From WikiChip
Editing mirc/identifiers/$regerrstr

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 1: Line 1:
{{mirc title|$regerrstr Identifier}}'''$regerrstr''' returns the PCRE error string of the compile function for the last regex call made, if any.
+
{{mirc title|$regerrstr Identifier}}'''$regerrstr''' returns the PCRE error string for the last regex call made, if any  
  
A regular expression must be compiled first, and then it's executed against a string.
 
 
If an error occurs in the compile function, $regerrstr is filled with an error string, corresponding to a positive number (listed below), but only the string is returned.
 
 
$regex and similar regex functions reporting number of matches ($regsubex with output variable or $regsub) will report a value of -14.
 
 
This value actually comes from the exec function, this is for convenience. $regex etc always return a negative value when an error occurs.
 
 
-14 is supposed to mean an internal pcre error, but this is only the case if $regerrstr is not set, then. You can find more info about on the regex page
 
  
 
== Synopsis ==
 
== Synopsis ==
Line 22: Line 13:
 
== List of error ==
 
== List of error ==
  
* 1: \ at end of pattern
+
0  no error
* 2: \c at end of pattern
+
          1  \ at end of pattern
* 3: unrecognized character follows \
+
          2  \c at end of pattern
* 4: numbers out of order in {} quantifier
+
          3  unrecognized character follows \
* 5: number too big in {} quantifier
+
          4  numbers out of order in {} quantifier
* 6: missing terminating ] for character class
+
          5  number too big in {} quantifier
* 7: invalid escape sequence in character class
+
          6  missing terminating ] for character class
* 8: range out of order in character class
+
          7  invalid escape sequence in character class
* 9: nothing to repeat
+
          8  range out of order in character class
* 10: [this code is not in use]
+
          9  nothing to repeat
* 11: internal error: unexpected repeat
+
        10  [this code is not in use]
* 12: unrecognized character after (? or (?-
+
        11  internal error: unexpected repeat
* 13: POSIX named classes are supported only within a class
+
        12  unrecognized character after (? or (?-
* 14: missing )
+
        13  POSIX named classes are supported only within a class
* 15: reference to non-existent subpattern
+
        14  missing )
* 16: erroffset passed as NULL
+
        15  reference to non-existent subpattern
* 17: unknown option bit(s) set
+
        16  erroffset passed as NULL
* 18: missing ) after comment
+
        17  unknown option bit(s) set
* 19: [this code is not in use]
+
        18  missing ) after comment
* 20: regular expression is too large
+
        19  [this code is not in use]
* 21: failed to get memory
+
        20  regular expression is too large
* 22: unmatched parentheses
+
        21  failed to get memory
* 23: internal error: code overflow
+
        22  unmatched parentheses
* 24: unrecognized character after (?<
+
        23  internal error: code overflow
* 25: lookbehind assertion is not fixed length
+
        24  unrecognized character after (?<
* 26: malformed number or name after (?(
+
        25  lookbehind assertion is not fixed length
* 27: conditional group contains more than two branches
+
        26  malformed number or name after (?(
* 28: assertion expected after (?(
+
        27  conditional group contains more than two branches
* 29: (?R or (?[+-]digits must be followed by )
+
        28  assertion expected after (?(
* 30: unknown POSIX class name
+
        29  (?R or (?[+-]digits must be followed by )
* 31: POSIX collating elements are not supported
+
        30  unknown POSIX class name
* 32: this version of PCRE is compiled without UTF support
+
        31  POSIX collating elements are not supported
* 33: [this code is not in use]
+
        32  this version of PCRE is compiled without UTF support
* 34: character value in \x{} or \o{} is too large
+
        33  [this code is not in use]
* 35: invalid condition (?(0)
+
        34  character value in \x{} or \o{} is too large
* 36: \C not allowed in lookbehind assertion
+
        35  invalid condition (?(0)
* 37: PCRE does not support \L, \l, \N{name}, \U, or \u
+
        36  \C not allowed in lookbehind assertion
* 38: number after (?C is > 255
+
        37  PCRE does not support \L, \l, \N{name}, \U, or \u
* 39: closing ) for (?C expected
+
        38  number after (?C is > 255
* 40: recursive call could loop indefinitely
+
        39  closing ) for (?C expected
* 41: unrecognized character after (?P
+
        40  recursive call could loop indefinitely
* 42: syntax error in subpattern name (missing terminator)
+
        41  unrecognized character after (?P
* 43: two named subpatterns have the same name
+
        42  syntax error in subpattern name (missing terminator)
* 44: invalid UTF-8 string (specifically UTF-8)
+
        43  two named subpatterns have the same name
* 45: support for \P, \p, and \X has not been compiled
+
        44  invalid UTF-8 string (specifically UTF-8)
* 46: malformed \P or \p sequence
+
        45  support for \P, \p, and \X has not been compiled
* 47: unknown property name after \P or \p
+
        46  malformed \P or \p sequence
* 48: subpattern name is too long (maximum 32 characters)
+
        47  unknown property name after \P or \p
* 49: too many named subpatterns (maximum 10000)
+
        48  subpattern name is too long (maximum 32 characters)
* 50: [this code is not in use]
+
        49  too many named subpatterns (maximum 10000)
* 51: octal value is greater than \377 in 8-bit non-UTF-8 mode
+
        50  [this code is not in use]
* 52: internal error: overran compiling workspace
+
        51  octal value is greater than \377 in 8-bit non-UTF-8 mode
* 53: internal error: previously-checked referenced subpattern not found
+
        52  internal error: overran compiling workspace
* 54: DEFINE group contains more than one branch
+
        53  internal error: previously-checked referenced subpattern
* 55: repeating a DEFINE group is not allowed
+
              not found
* 56: inconsistent NEWLINE options
+
        54  DEFINE group contains more than one branch
* 57: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number
+
        55  repeating a DEFINE group is not allowed
* 58: a numbered reference must not be zero
+
        56  inconsistent NEWLINE options
* 59: an argument is not allowed for (*ACCEPT), (*FAIL), or (*COMMIT)
+
        57  \g is not followed by a braced, angle-bracketed, or quoted
* 60: (*VERB) not recognized or malformed
+
              name/number or by a plain number
* 61: number is too big
+
        58  a numbered reference must not be zero
* 62: subpattern name expected
+
        59  an argument is not allowed for (*ACCEPT), (*FAIL), or (*COMMIT)
* 63: digit expected after (?+
+
        60  (*VERB) not recognized or malformed
* 64: ] is an invalid data character in JavaScript compatibility mode
+
        61  number is too big
* 65: different names for subpatterns of the same number are not allowed
+
        62  subpattern name expected
* 66: (*MARK) must have an argument
+
        63  digit expected after (?+
* 67: this version of PCRE is not compiled with Unicode property support
+
        64  ] is an invalid data character in JavaScript compatibility mode
* 68: \c must be followed by an ASCII character
+
        65  different names for subpatterns of the same number are
* 69: \k is not followed by a braced, angle-bracketed, or quoted name
+
              not allowed
* 70: internal error: unknown opcode in find_fixedlength()
+
        66 (*MARK) must have an argument
* 71: \N is not supported in a class
+
        67 this version of PCRE is not compiled with Unicode property
* 72: too many forward references
+
              support
* 73: disallowed Unicode code point (>= 0xd800 && <= 0xdfff)
+
        68  \c must be followed by an ASCII character
* 74: invalid UTF-16 string (specifically UTF-16)
+
        69  \k is not followed by a braced, angle-bracketed, or quoted name
* 75: name is too long in (*MARK), (*PRUNE), (*SKIP), or (*THEN)
+
        70  internal error: unknown opcode in find_fixedlength()
* 76: character value in \u.... sequence is too large
+
        71  \N is not supported in a class
* 77: invalid UTF-32 string (specifically UTF-32)
+
        72  too many forward references
* 78: setting UTF is disabled by the application
+
        73  disallowed Unicode code point (>= 0xd800 && <= 0xdfff)
* 79: non-hex character in \x{} (closing brace missing?)
+
        74  invalid UTF-16 string (specifically UTF-16)
* 80: non-octal character in \o{} (closing brace missing?)
+
        75  name is too long in (*MARK), (*PRUNE), (*SKIP), or (*THEN)
* 81: missing opening brace after \o
+
        76  character value in \u.... sequence is too large
* 82: parentheses are too deeply nested
+
        77  invalid UTF-32 string (specifically UTF-32)
* 83: invalid range in character class
+
        78  setting UTF is disabled by the application
* 84: group name must start with a non-digit
+
        79  non-hex character in \x{} (closing brace missing?)
* 85: parentheses are too deeply nested (stack check)
+
        80  non-octal character in \o{} (closing brace missing?)
 +
        81  missing opening brace after \o
 +
        82  parentheses are too deeply nested
 +
        83  invalid range in character class
 +
        84  group name must start with a non-digit
 +
        85  parentheses are too deeply nested (stack check)
  
 
== Example ==
 
== Example ==
<source lang="mIRC">//echo -a $regex($str(a,2700),/(?<=a*)/) $regerrstr</source>
+
<source lang="mIRC">//echo -a $regex($str(a,2700),/a*(a*)*b/) $regerrstr</source>
  
 
== Compatibility ==
 
== Compatibility ==

Please note that all contributions to WikiChip may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see WikiChip:Copyrights for details). Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)