Given the following string:
>>> s = 'Claude Binyon [Director / Screenwriter] Walter Benjamin Hare [Play Author]'
I want to achieve the following:
'Claude Binyon,Walter Benjamin Hare,'
I have the following regex, but it is greedy, so is replacing everything after the [. How would I make the following non-greedy to work as needed?
>>> re.sub('\[.+]',',',s)
'Claude Binyon ,'
Try doing this :