I'm currently trying to get a match on an empty string in PHP, this current run through should match not
and empty ''
but I can only seem to get it to match not
for some reason? Could someone tell me what I'm doing wrong?
preg_match('/^\bnot|$/', 'not', $matches);
print_r($matches); // array(0 => 'not') // correct
preg_match('/^\bnot|$/', '', $matches);
print_r($matches); // array(0 => '') // maybe right ?
preg_match('/^\bnot|$/', 'foo', $matches);
print_r($matches); // array(0 => '') // deff messed up