Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upSomething wrong with String search() method. #760
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
shvaikalesh
Dec 30, 2016
Contributor
String.prototype.search converts argument to a regular expression, thus dot matches any (except newline) character.
|
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
bakkot
Dec 30, 2016
Contributor
String.prototype.search takes a regex argument, not a string (apassed string is converted to a regex), and . in a regex matches any non-newline character.
StackOverflow is probably a better place for this kind of question.
|
String.prototype.search takes a regex argument, not a string (apassed string is converted to a regex), and StackOverflow is probably a better place for this kind of question. |
DarkOverkill commentedDec 30, 2016
•
edited
search() - can't see difference between character '.' and '_'.
was tested on:
Chromiun - Version 55.0.2883.87 Built on Ubuntu , running on Ubuntu 16.04 (64-bit)
Google Chrome - Version 53.0.2785.116 (64-bit)
Firefox - 50.1.0
Is this a bug? Or some feature, which I don't know about?