I am trying to write a complex regular expression pattern and a small part inside the regex is confusing me. Here is the example,
var s = /^((?!\bN\b).)*$/
console.log(s.test('N'));
While passing,
N123
- true
NABC
- true
N
- false
N
- false
(with space right next to N)
N/
- false
N+
- false
N-
- false
Question: Strings works fine only when it has a continuous characters following with N
. But why it is false when there is a space or special character?