Closed
Bug 225343
Opened 22 years ago
Closed 22 years ago
Regexp pattern /[A]/i not matching 'a'
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
VERIFIED
FIXED
People
(Reporter: rob, Assigned: brendan)
References
()
Details
(Keywords: js1.5, regression, Whiteboard: [ bug 225366 has been filed against Rhino for the same issue])
Attachments
(1 file)
6.39 KB,
patch
|
shaver
:
superreview+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6b) Gecko/20031110 Firebird/0.7+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6b) Gecko/20031110 Firebird/0.7+
http://www.the-allens.net/csstest/jstest.htm contains a simple form with a JS
email checker. The core code is:
function checkemail(str) {
var result = false;
var filter =
/^[-!#$%&\'*+\.\/0-9=?A-Z^_`{|}~]+@([-0-9A-Z]+\.)+([0-9A-Z]){2,4}$/i;
var test = filter.test(str);
if (test === true){
result = true;
}
return result;
}
This function fails to correctly identify the email address "nospam@test.com" as
valid. IE, Moxilla 1.5 and Opera all successfully identify that email address as
correct.
Reproducible: Always
Steps to Reproduce:
1. Navigate to http://www.the-allens.net/csstest/jstest.htm
2. Press the "update" button
3. Read the JS Application message that is displayed in a popup box.
Actual Results:
Text in alert() box is "Please enter a valid email address"
Expected Results:
Text in alert() box should be "Email address is valid"
doron built the seamonkey code today to test this for me and reported that the
error also occurs on seamonkey.
Also, this is a regression from Mozilla 1.5. I haven't tested all nightlys from
then to now as I'm on dial-up.
Comment 2•22 years ago
|
||
I have found that if you replace the A-Z character ranges with a-z
in the above example, the bug goes away. That means it reduces to:
js> 'a'.match(/[a]/i);
a <----------------------- correct
js> 'a'.match(/[A]/i);
null <----------------------- bug
We used to return 'a' for both, but this has changed since the
checkin for bug 85721.
Comment 3•22 years ago
|
||
Testcase added to JS testsuite:
mozilla/js/tests/ecma_3/RegExp/regress-225343.js
Currently failing in Rhino as well as SpiderMonkey. Passes if run
against the RC5a release of SpiderMonkey.
I have filed bug 225366 against Rhino for this same issue -
Summary: JS regexp function "test" fails → Regexp pattern /[A]/i not matching 'a'
Whiteboard: [ bug 225366 has been filed against Rhino for the same issue]
Assignee | ||
Comment 4•22 years ago
|
||
Phil: can you test ranges also?
/[A-Z]/i('a')
Also, test a bunch of inputs other than 'a' -- test toward the end of the ASCII
charset, test higher into Unicode, etc.
/be
Assignee: general → brendan
Assignee | ||
Comment 5•22 years ago
|
||
I'm not happy with the bugs I'm finding in jsregexp.c. Hope this is it for
now.
/be
Assignee | ||
Updated•22 years ago
|
Status: NEW → ASSIGNED
Flags: blocking1.6b+
Priority: -- → P1
Target Milestone: --- → mozilla1.6beta
Assignee | ||
Updated•22 years ago
|
Attachment #135748 -
Flags: superreview?(shaver)
Attachment #135748 -
Flags: review?(zack-weg)
Comment 6•22 years ago
|
||
Comment on attachment 135748 [details] [diff] [review]
proposed fix
Sure looks better to me.
Attachment #135748 -
Flags: superreview?(shaver) → superreview+
Assignee | ||
Comment 7•22 years ago
|
||
Fixed. Fixes the checkemail() test function in comment 0.
Phil, the test suite passes except for the known Array truncation performance
test, and these two tests:
Testcase ecma_2/RegExp/properties-001.js failed Bug Number
http://scopus/bugsplat/show_bug.cgi?id=346000
[ Next Failure | Top of Page ]
Failure messages were:
/(?:)/.toString() = /(?:)/ FAILED! expected: //
Testcase js1_2/regexp/toString.js failed
[ Previous Failure | Next Failure | Top of Page ]
Failure messages were:
var re = new RegExp(); re.toString() = /(?:)/ FAILED! expected: //
Can you update the testsuite to expect empty regexps to decompile as /(?:)/ in
all cases? Thanks,
/be
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Comment 8•22 years ago
|
||
Marking Verified FIXED.
Testcase mozilla/js/tests/ecma_3/RegExp/regress-225343.js now passes.
> Fixes the checkemail() test function in comment 0.
True, and this is part of the above testcase, as well
> Can you update the testsuite to expect empty regexps to decompile as /(?:)/ ?
Done -
Status: RESOLVED → VERIFIED
Priority: P1 → --
Target Milestone: mozilla1.6beta → ---
Updated•21 years ago
|
Attachment #135748 -
Flags: review?(zack-weg)
Updated•20 years ago
|
Flags: testcase+
You need to log in
before you can comment on or make changes to this bug.
Description
•