user463132
user463132

Reputation: 41

PHP Regex XML to allow attributes

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

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

Upvotes: 0

Views: 308

Answers (1)

mario
mario

Reputation: 145482

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

Upvotes: 1

Related Questions