There is such code:

$url = '[LAST]1[/LAST]'; var_dump(preg_match('/\[LAST\]*\[\/LAST\]/', $url,$array)); 

He should get the insides [LAST][/LAST]

Gives 0 or simple false

What could be the problem?

  • change the star to a point - splash58
  • @ splash58 Works, but gives not the insides, but the entire line ... - Maks

1 answer 1

Try this

 var_dump(preg_match('/\[LAST\](.*)\[\/LAST\]/', $url,$array)); 
  • 2
    I would reduce the quantifier’s greed: /\[LAST\](.*?)\[\/LAST\]/ - VenZell