Grab text between ""

$string = ‘var togo = “gowentgone”’;

how can i grab the text with preg_match_all?
preg_match_all(‘/“(.*)”/i’, $string, $result) ;

You can safely drop the /i at the end. " is just a character; it doesn’t have a lowercase and uppercase variant :slight_smile:

Agreed! Copy n paste :stuck_out_tongue:


$string = 'var togo = "gowentgone";
var togo1 = "gowentgone1";
var togo2 = "gowentgone2"';
preg_match_all('/"(.*?)"/i', $string, $matches) ;
print_r($matches[1]);