πŸ“Š JavaScript
Q. The regular expression to match any one character not between the brackets is __________
  • (A) [\D]
  • (B) [^...]
  • (C) [^]
  • (D) [....]
πŸ’¬ Discuss
βœ… 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')

Explanation by: Mr. Dubey

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')

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
173
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Ram Sharma
Publisher
πŸ“ˆ
92%
Success Rate