I am trying to write a regular expression that will match all cases of
[[any text or char her]]
in a series of text.
Eg:
My name is [[Sean]]
There is a [[new and cool]] thing here.
This all works fine using my regex.
data = "this is my tes string [[ that does some matching ]] then returns."
p = re.compile("\[\[(.*)\]\]")
data = p.sub('STAR', data)
The problem is when I have multiple instances of the match occuring :[[hello]] and [[bye]]
Eg:
data = "this is my new string it contains [[hello]] and [[bye]] and nothing else"
p = re.compile("\[\[(.*)\]\]")
data = p.sub('STAR', data)
This will match the opening bracket of hello and the closing bracket of bye. I want it to replace them both.