mardi 20 décembre 2016

Php regex return values within a pattern

I'm looking for a regex to return the values in between Parameter("").

So for 1 + Parameter("MyVariable") + 36 * Parameter("Hello") + NoParameter("Nine") it should return MyVariable and Hello. I already found a way to return the values between quotes, but this includes the NoParameter result as well. Any tips on how to integrate the Parameter() part?

<?php

$string     =   '1 + Parameter("MyVariable") + 36 * Parameter("Hello") + NoParameter("Nine")';

preg_match_all('/"([^"]+)"/', $string, $matches); 

print_r($matches[1]);

?>

Aucun commentaire:

Enregistrer un commentaire