You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Platform: Linux 4.15.0-132-generic Introduce the Nil Object #136-Ubuntu SMP Tue Jan 12 14:58:42 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Subsystem:
What steps will reproduce the bug?
Hi, I am not totally sure if this is a bug or if it is expected, but it seems to be a problematic behavior.
Execute the following NodeJS code. Creting a RegExp with an undefined variable will always match any string:
undefined is treated as the empty string in the RegExp constructor. The JavaScript specification dictates this behavior, and it is implemented in V8, so it is out of Node's control.
Version: 12.20.0
Platform: Linux 4.15.0-132-generic Introduce the Nil Object #136-Ubuntu SMP Tue Jan 12 14:58:42 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Subsystem:
What steps will reproduce the bug?
Hi, I am not totally sure if this is a bug or if it is expected, but it seems to be a problematic behavior.
Execute the following NodeJS code. Creting a RegExp with an undefined variable will always match any string:
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior?
I am not totally sure if this is unexpected, but IMHO I would expect an error when trying to create an
undefined
regular expression.What do you see instead?
I see that the undefined regex matches always any string. It produces unexpected outputs if you use it, for example, to test a match inside an if.
Additional information
The text was updated successfully, but these errors were encountered: