python regex match optional square brackets
问题 I have the following strings: 1 "R J BRUCE & OTHERS V B J & W L A EDWARDS And Ors CA CA19/02 27 February 2003", 2 "H v DIRECTOR OF PROCEEDINGS [2014] NZHC 1031 [16 May 2014]", 3 '''GREGORY LANCASTER AND JOHN HENRY HUNTER V CULLEN INVESTMENTS LIMITED AND ERIC JOHN WATSON CA CA51/03 26 May 2003''' I am trying to find a regular expression which matches all of them. I don't know how to match optional square brackets around the date at the end of the string eg [16 May 2014]. casename = re.compile