I’m looking for a regex that could replace all “[” with an “->” but only when it’s not followed by “]”.
And replace at the same time all of the “]” with nothing, but only when they are not next to an “[“
So in other word “test[hi][]” will be become “test->hi[]”
Thank you 😉
I really have no clue how to do that 😉
I’ve made the assumptions that what exist between the brackets follows PHP variable naming conventions (i.e. letters, digits, underscores) and your code is valid (e.g. no
$test['five]).This should handle:
But not: