-1

I tried to load a html file with values to replace, but first i want to get all of them... but preg_match_all always return NULL.

The result of "var_dump($htmlcontent);" :

string(643) "<tr>
    <td>
        <input type="checkbox" name="solved" value="1" onchange="...">
    </td>
    <td>{{description}}</td>
    <td>{{solved}}</td>
    <td>

[...]

And:

$bla = preg_match_all( '\{\{(\w+)\}\}', 'bla {{ble}}', $dataToFill);

var_dump($bla); // bool(false) 
var_dump($dataToFill); //NULL 

and I don't know by. The regular expression works in all the online testers I tried, so, what's happends?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Muribury
  • 3
  • 2

1 Answers1

2

You forgot to add delimiters to your regex.

$bla = preg_match_all('/\{\{(\w+)\}\}/', 'bla {{ble}}', $dataToFill);
gen_Eric
  • 223,194
  • 41
  • 299
  • 337