Hi,

> Daniel Lorch wrote:
>> shouldn't this be
>> [^>]+ instead of [^]]+
>   This yields the same result.

because nothing matches the whitespace character, and foo is also not
matched. i would suggest following regular expression:

--- snip ----------------------------------------
    <pre>
    <?php
    preg_match_all("'([^ ]+) *= *\"?([^\" >]*)\"? *'im",
                   '<php:foo var1="value1" var2="value2" />',
                   $matches
                  );
    
    parray_tree($matches);
    ?>
    </pre>
--- snip ----------------------------------------

which yields this result:

--- snip ----------------------------------------
  |-+ 0 (array)
  | |-> 0 = "var1="value1" " (string)
  | |-> 1 = "var2="value2" " (string)
  |-+ 1 (array)
  | |-> 0 = "var1" (string)
  | |-> 1 = "var2" (string)
  |-+ 2 (array)
  | |-> 0 = "value1" (string)
  | |-> 1 = "value2" (string)
--- snip ----------------------------------------

this will also match non-regular syntaxes such as

  var1  = value1
  var1 =   "value1"

but is still somewhat buggy, because this isn't matched:

  var1="value1 blub"

maybe you find a better method. the "Back references" which are needed
to accomplish this (as described in the manual) don't seem to work
(bug?). any regular expression GOD around here?
  
btw: you don't have to escape characters like >. also, try to use
     other regular expression-delimitors instead of /../ if you use the
     slash frequently in the expression.

Kind Regards,
  Daniel Lorch
-- 
if(empty($a) == true ? true : false)



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to