I have the following string:
x = r"""<FNT size='9'>" & [FacilityID] & " " & [DIAMETER] & "</FNT>"""
Trying dynamically using regular expressions or similar to get final result of :
[FacilityID] & " " & [DIAMETER]
Cannot hardcore the end result.
I have this to remove the from of string up to first [
b = re.sub(r'^.*?\&\s', '', x)
But I can't figure out how to do the reverse to the first ] reading from right to left.
I think i need to use the $ sign but I can't get it to work, thanks
x = '[FacilityID] & " " & [DIAMETER]'?\s\&[^&]*$'[FacilityID] & " " & [DIAMETER]'. If you want anything else, you need to specify what characters the brackets can contain.