php – How i can perform this function which parse a string


i have wrote this function:

function parser ($src) {
    preg_match_all("/{(.*)}/", $src, $tmp); 
    foreach ($tmp(1) as $vkey => $row) {
        preg_match_all("/((a-z0-9)+)="((wds)+)"/", $row, $col); 
        foreach ($col(0) as $ckey => $param) {
            $row = str_replace($col( 0 )( $ckey ), "", $row );
            $arr($vkey)("attrib")($col( 1 )( $ckey )) = $col( 2 )( $ckey );             
        }
        $arr($vkey)("element") = $row;
    }
    return $arr;
}

Passing this string:

$string = "
    {data:one surname="Rossi" name="Mario"}
    {data:two}
    {data:three text="this is a text"}
"; 

And calling the function parser:

$result = parser( $string );

i have this output:

Array
(
    (0) => Array
        (
            (attrib) => Array
                (
                    (surname) => Rossi
                    (name) => Mario
                )

            (element) => data:one  
        )

    (1) => Array
        (
            (element) => data:two
        )

    (2) => Array
        (
            (attrib) => Array
                (
                    (text) => this is a text
                )

            (element) => data:three 
        )

)

Is possible perform the parser function with a regular expression and have same result?
Thanks!

IMPORTANT: The string is similar to XML format but not is XML format. Here is just for a example