Here I was, looking for an error in the actual regex xD
I was not even aware of this weird behaviour, and would probably have written it as
/* line 6 */ return value.match(TEST_REGEXP)
instead, and anchored the regex to beginning and end, of course :D
And for the actual answer:
--- before.js 2021-11-03 16:31:00.256761809 +0100 +++ after.js 2021-11-03 16:30:46.961086329 +0100 @@ -1,4 +1,4 @@ -const TEST_REGEXP = /[a-z0-9]+_[a-z0-9]+/gi; +const TEST_REGEXP = /^[a-z0-9]+_[a-z0-9]+$/i; function isValidName(value) { if (typeof value !== 'string') return false;
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Here I was, looking for an error in the actual regex xD
I was not even aware of this weird behaviour, and would probably have written it as
instead, and anchored the regex to beginning and end, of course :D
And for the actual answer: