Closed Bug 1363606 Opened 9 years ago Closed 9 years ago

"1234,123,12".match(/12/) returns ["12"] wrong results

Categories

(Core :: JavaScript Engine, defect)

53 Branch
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: jmichae3, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:53.0) Gecko/20100101 Firefox/53.0 Build ID: 20170504105526 Steps to reproduce: ctrl-shift-i console "1234,123,12".match(/12/) Actual results: Array [ "12" ] returned an array with the search string in the element. Expected results: Array [ "1234,123,12" ] I would have suspected, if grep is any indicator of how regex matching is to be done, it returns the line found that matches. is this according to spec?
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
String.prototype.match returns the matched substring. If you need to the complete string, the regexp needs to be changed to `/12.*/`.
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.