• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

regex to get db username from config.php

Mouth

Well-known member
#1
Hi,
I'm only a basic regex'er, so looking for some help please. Wanting to grep the xf config.php to pull out the db username.

config.php contains
PHP:
[...]
$config['db']['username'] = 'myusername';
[...]
my best effort, yet still unsuccessful, grep so far is
Code:
grep -o "(\$config\[\'db\'\]\[\'username\'\]\ \=\ \').*" library/config.php
Can anyone assist with the correct regex for the grep to pull out myusername please?