RegExp pattern validation does not work correctly

UNCONFIRMED
Unassigned

Status

()

Core
JavaScript Engine
UNCONFIRMED
2 years ago
2 years ago

People

(Reporter: rej-scheijen, Unassigned)

Tracking

41 Branch
x86_64
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [parity-chrome][parity-opera])

(Reporter)

Description

2 years ago
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0
Build ID: 20150918100310

Steps to reproduce:

When creating a form with with a pattern validation (Dutch postall check) I noticed that the pattern validation was not working correctly.
It did on Chromium and on Opera.
The problem seems to be in the {[amount]} operator

This works : [1-9][0-9][0-9][0-9]\s?\w\w
This does not : [1-9][0-9]{3}\s?\w{2}


Actual results:

The value in the field was marked invalid (my own postal code)

Happens in Firefox 41
Happens in nightly build


Expected results:

The value should have been marked as valid.
All combinations with a {[amount]} operator in it seems to be faulty
(Reporter)

Updated

2 years ago
OS: Unspecified → Linux
Hardware: Unspecified → x86_64

Updated

2 years ago
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
Summary: pattern validation does not work correctly → RegExp pattern validation does not work correctly
Whiteboard: [parity-chrome][parity-opera]
Can you post a testcase, including input data and the actual JavaScript code?
Flags: needinfo?(rej-scheijen)
In particular, what actual string are you typing in?

When I try this testcase: data:text/html,<input pattern="[1-9][0-9]{3}\s?\w{2}">

and type in "1234ab", it's correctly flagged as valid...
(Reporter)

Comment 3

2 years ago
Hmmm never mind.
This will be a bugreport for the template parser of the framework.
For some reason he thinks that the {3} and {2} are unused template variables and removes them just before sending the page.
Flags: needinfo?(rej-scheijen)
How did things work in Chrome/Opera then?
You need to log in before you can comment on or make changes to this bug.