What’s the regular expression that matches a square bracket? December 19, 2022 by Tarik How about using backslash \ in front of the square bracket. Normally square brackets match a character class.