Hello list :)

Just a short question which I know it should be easy, but I'm no expert yet
in regular expressions.
I've got a nice little XML string, which is something like this but can be
changed:

<?xml version="1.0" encoding="utf-8"?>
<boolean xmlns="http://tempuri.org/";>false</boolean>

The boolean value can be true or false, so what I want to do, is filter it.
I've done it this way, but I know it can be improved (just because I love
clean coding and also because I want to master regular expressions xD):

  $result = preg_match('/true/',$curl_response);
  if ($result == 0) $result = preg_match('/false/',$curl_response);

I've also tried something like:
$result = preg_replace('/^(true)|^(false)/','',$curl_response); // if not
true OR not false => replace with empty

and also '/^true|^false/' which doesn't seem to work.

Any ideas to filter this kind of string in just one expression?

Thanks in advance :)

-- 
Mailed by:
UnReAl4U - unreal4u
ICQ #: 54472056
www1: http://www.chw.net/
www2: http://unreal4u.com/

Reply via email to