1

I am trying to find anything between [ and ] Here is what I have so far and isn't working. I am aware that I can use string.find("[") to get the positions but I am trying to get better at using regex.

string = '[12/Aug/2000:06:29:11 -]'
pattern = re.compile(r'[\[][.][\]]')
matches = pattern.finditer(string)
for match in matches:
    print(match)
user3525290
  • 1,557
  • 2
  • 20
  • 47

0 Answers0