preg_match returning result three times

I’m not entirely sure if this is a problem with my regexp pattern, or my usage of preg_match (which I’ve used in the past) but here’s the scenario.

The pattern definition;


$f_patternArray['name'] 	= "/((?!@)([^{]*))/";


$f_entryDirtyArray[1] = "@Mysql";
preg_match($f_patternArray['name'], $f_entryDirtyArray[1], $matches);

Note: The name can come in a variety of formats such as (Note the portion which the pattern should select is marked in green);
@Mysql
Mysql The Great {39471731834374}


Array
(
    [0] => Mysql
    [1] => Mysql
    [2] => Mysql
)

The above is the return result … and the problem … why am I getting the result back THREE times?

So you’re trying to select everything between a @ and a {?

“/@(.*?)\{/”

Keep in mind anything you wrap in () gets returned separately, with the 0th array item being things that matched the whole pattern, 1 being the items matching the first sub pattern, etc…