PHP Regex XML to allow attributes
/<peanut\:compressedContent>(.*?)<\/peanut\:compressedContent>/si
currently support no attributes but i also want to cap开发者_开发知识库ture the stuff even if it has attributes.
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
精彩评论