I'm trying to match square brackets (using character class) in python. But the following code is not successful. Does anybody know what is the correct way to do?
#!/usr/bin/env python
import re
prog = re.compile('[\[]+')
print prog.match('a[f')
prog = re.compile('[\]]+')
print prog.match('a]f')