0
/<peanut\:compressedContent>(.*?)<\/peanut\:compressedContent>/si

currently support no attributes but i also want to capture the stuff even if it has attributes.

6
  • 3
    "Have you tried using an XML parser instead?" Commented Mar 4, 2011 at 18:17
  • this is just extracting compressed gzip content; then gunziping it and then i am using simple xml parser.. Commented Mar 4, 2011 at 18:18
  • Don't use REGEX when you should use DOM/XML parsing. See: php.net/DOM and php.net/xml Commented Mar 4, 2011 at 18:19
  • I am not using a full XML Document! Commented Mar 4, 2011 at 18:25
  • By using your method: because i am not using a full crystal clear xml document its a binary document with alot of hex jibberish and partial xml... long story.... Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in C:\xampp\htdocs\gunzip.php on line 19 Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Start tag expected, '<' not found in C:\xampp\htdocs\gunzip.php on line 19 Warning: simplexml_load_string() [function.simplexml-load-string]: in C:\xampp\htdocs\gunzip.php on line 19 Commented Mar 4, 2011 at 18:26

1 Answer 1

1

http://www.regular-expressions.info/examples.html#~HTML

You can use [^>]* to match/ignore anything within tags. Likewise you might want to use [^<>]* instead of .*? for ensuring it only matches text content:

/<peanut:compressedContent[^>]*>([^<>]*)<\/peanut:compressedContent>/si
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.