Quantcast
Channel: Active questions tagged config - Stack Overflow
Viewing all articles
Browse latest Browse all 5054

PHP - Regex getting a string between square brackets including nested brackets and with specified prefix [duplicate]

$
0
0

How can I match the

'api-tools-mvc-auth' => ['authentication' => ['adapters' => ['comics' => ['adapter' => 'Laminas\\ApiTools',                ],            ],        ],    ],

from the contents of:

return ['db' => ['username' => 'root','password' => '',    ],'api-tools-mvc-auth' => ['authentication' => ['adapters' => ['comics' => ['adapter' => 'Laminas\\ApiTools',                ],            ],        ],    ],

So the match need to contain any nested [] as well as new line characters. BUT it can only match the section with particular prefix, for instance: 'api-tools-mvc-auth' => [

I am using regex in PHP.

So far I only have a regex which work just for single lines: https://regex101.com/r/GXtk6v/2


Viewing all articles
Browse latest Browse all 5054

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>