Q. The regular expression to match any one character not between the brackets is __________
β
Correct Answer: (B)
[^...]
Explanation:
In regular expressions, [^...] matches any one character that is not listed inside the brackets.
- The ^ at the beginning inside [] negates the character set.
Example:
let regex = /[^abc]/;
console.log(regex.test('d')); // true (because 'd' is not 'a', 'b', or 'c')