'What is regex for square bracket character in javascript [closed]

Can anyone tell me how to make regex for square brackets ( [ ] ) in JavaScript?



Solution 1:[1]

You need to escape the square brackets with a backslash: \[\]

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mads Hansen