1. 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

Discussion in 'XenForo Development Discussions' started by Mouth, Aug 11, 2014.

  1. Mouth

    Mouth Well-Known Member

    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?
     

Share This Page