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

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

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
user463132
  • 41
  • 2
  • 3
    ["Have you tried using an XML parser instead?"](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454) – BoltClock Mar 04 '11 at 18:17
  • this is just extracting compressed gzip content; then gunziping it and then i am using simple xml parser.. – user463132 Mar 04 '11 at 18:18
  • Don't use REGEX when you should use DOM/XML parsing. See: http://php.net/DOM and http://php.net/xml – McHerbie Mar 04 '11 at 18:19
  • I am not using a full XML Document! – user463132 Mar 04 '11 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 – user463132 Mar 04 '11 at 18:26
  • so in short would someone just help me with my question... i am aware of simple xml and others. – user463132 Mar 04 '11 at 18:27

1 Answers1

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
mario
  • 144,265
  • 20
  • 237
  • 291