Closed Bug 89586 Opened 23 years ago Closed 23 years ago

Error interpretting regexp expressions

Categories

(Core :: JavaScript Engine, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

VERIFIED INVALID

People

(Reporter: vicentesalvador, Assigned: rogerl)

Details

Attachments

(1 file)

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
Attached file Test case
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.... 
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)
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
Marking Verified - 
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: