php - get content from second pair of quotes in string
- by Aaron Turecki
I'm trying to get the contents of the second quotes and only the second quotes from a string. Right now I'm able to get the contents of all three quotes. What am I doing wrong? Is it possible to just print the second value in the output array?
Text
2014-06-02 11:48:41.519 -0700 Information 94 NICOLE Client "[WebDirect] (207.230.229.204) [207.230.229.204]" opening database "FMServer_Sample" as "Admin".
PHP
if (preg_match_all('~(["\'])([^"\']+)\1~', $line, $matches))
$database_names = $matches[2];
print_r($database);
Output
[WebDirect] (207.230.229.204) [207.230.229.204], FMServer_Sample, Admin