Closed
Bug 89586
Opened 23 years ago
Closed 23 years ago
Error interpretting regexp expressions
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
VERIFIED
INVALID
People
(Reporter: vicentesalvador, Assigned: rogerl)
Details
Attachments
(1 file)
122 bytes,
text/html
|
Details |
This html source throws a Javascript exception. This shouldn't:
<html>
<head>
<script>
reg_exp = /\w|\s|[!-/]|[:-@]|[\[-`]|[{-ÿ]/;
</script>
</head>
<body>
</body>
</html>
The exception throwed is:
Error: unterminated character class [
Source File: file:///C:/tmp/test.html
Line: 4, Column: 15
Source Code:
reg_exp = /\w|\s|[!-/]|[:-@]|[\[-`]|[{-ÿ]/;
This sould work because \[ is escaped
Reporter | ||
Comment 1•23 years ago
|
||
Comment 2•23 years ago
|
||
This has nothing to do with the \[. The following throws the same exception:
reg_exp = /[!-/]/;
Escaping the "/" in the character class makes things happy (that is,
reg_exp = /\w|\s|[!-\/]|[:-@]|[\[-`]|[{-ÿ]/;
has no problems).
Looks invalid to me....
Comment 3•23 years ago
|
||
Boris is correct. Compare the following:
reg_exp1 = /\w|\s|[!-/]|[:-@]|[\[-`]|[{-ÿ]/;
reg_exp2 = /\w|\s|[!-\/]|[:-@]|[\[-`]|[{-ÿ]/;
In the standalone JS shell:
js> reg_exp1 = /\w|\s|[!-/]|[:-@]|[\[-`]|[{-ÿ]/;
7: unterminated character class [:
7: reg_exp = /\w|\s|[!-/]|[:-@]|[\[-`]|[{-ÿ]/;
7: ..........^
js> reg_exp2 = /\w|\s|[!-\/]|[:-@]|[\[-`]|[{-ÿ]/;
/\w|\s|[!-\/]|[:-@]|[\[-`]|[{-ÿ]/
(WORKS FINE)
Comment 4•23 years ago
|
||
Have to mark this one invalid. Vicente, thank you for this report.
We depend on contributors like you to catch the things that we miss -
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•