i'm trying to esssentially get any dynamic input from a python script, in this case its a simple file organizing script. I need to make sure that any instance of [ or ] is wrapped like this [[] []].
So naturally i tried replace but that just put brackets around all of the escape brackets(the escape brackets for using glob.glob)
That proved useless so now i turn to re.sub but i can't seem to find a pattern that will only replace [ or ] with its escape counterpart if the [ or ] has no brackets around it.
I have no idea if that makes sense to anyone but thats pretty much it, here is the messed up re pattern i've got so far, it doesn't like me.
pattern = r'[^\[]([\[])[^\]]'
[or]is used for quoting or they should be quoted ?