I need to retrieve all keys using pure regex. I need to start with word field and after that need to capture all multiple keys..
field[somevalue][anothervalue]
I'm using this regex:
/^field(?=\[(\w+)](?=\[(\w+)])?)/
But I can retrieve only two levels (somevalue and anothervalue)
I need to go deep and retrieve another levels like:
field[somevalue][anothervalue][other][some]...
So I need to retrieve somevalue, anothervalue, other, some and so on, starting with variable name field
I don't want to use loops like this (Regex for bracket notation of multi-dimensional array)
Need to pass directly and use in https://regex101.com
pcrelike this with a capture group?(?:field|\G(?!\A))\[([^][]*)\]See regex101.com/r/DaDXh3/1 or(?:field|\G(?!\A))\[(\w+)\]^field(?:\[(\w+)\])(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?regex101.com/r/LGoFoQ/1(?:\bfield|(?<=\[).*?(?=]))you could drop"field"and any matches that preceded it.