How to get the shortest rather than longest possible regex match with preg_match()

I have string similar to this one:

{{something1}} something2 {{something3}} something4

How can I match only "something1" using the preg_match() function?

I tried:

preg_match("/\{\{(.*)\}\}/si",$content,$matches);

but this matched too much, returning

something1}} something2 {{something3

I tried adding \b to the pattern, but didn't get what I want that way either.

Could you please help me with this?

8
задан einpoklum - reinstate Monica 28 March 2013 в 14:45
поделиться