Hi Everyone,

Im having a little problem with a peice of regex im trying to write... im a profficent coder when it comes to HTML, CSS, PHP, JavaScript and AS2/AS3 but the one thing that still trips me up again and again is regex!

Im trying to write a peice of regex that will be used with preg_replace to remove all "[" characters from a string as long as they don't appear within double (") or single (') quotes or a blackslash(\). When appearing in quotes it ([) could have any characters (a-zA-Z0-9/,.\;[]-_()*&^%$#@!`~<>?{}|) either side of it within the quotes. How would I do this? I have included the regex I tried to create to solve this problem but it doesn't quite work. I hope i'm on the right track...


Code:
[^[["|'][^"|']*\[[^"|']*["|']]]
I feel im almost on the right track but im not quite there. Any and all help would be appreciated.

Thanks,

Chris