I want to remove the parentheses from strings containing table or figure references. The parentheses can include multiple references. The pattern is somewhat consequent. Here are some examples:
text = [
"this is a figure ref (figure 7\xe2\x80\x9377)",
"this is multiple refs (figures 6\xe2\x80\x9328 and 6\xe2\x80\x9329)",
"this is a table ref (table 6\xe2\x80\x931)"
]
I'm using the following regex:
text = re.sub(r"\(([\w]\s\d(\\[a-z]+[0-9])+)\)", " ", text)