php-general | 2003022
Date: 02/17/03
- Next message: Jason Sheets: "Re: [PHP] RSA implementation"
- Previous message: Rob Packer: "[PHP] Re: .htpasswd and PayPal generated passwords"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
hello!
could somebody please help me to build a regexp to strip some attributes
from html code?
i'd like to remove all class="" attributes from html, but the example below
seems not match
i don't know what i'm doing wrong, this simply doesn't work!
<?php
$html = '<A href="http://www.anywhere.com" class="link"></A>';
echo "input:<br>".htmlspecialchars($html)."<hr>";
$html = preg_replace("|(<\w+[^>]*) +class=\"?.*\"?([^>]*)|iU", \\1\\2,
$html);
echo "output:<br>".htmlspecialchars($html)."<hr>";
?>
input:
<A href="http://www.anywhere.com" class="link"></A>
output:
<A href="http://www.anywhere.com""link"></A>
why this always removes 'class=' only???
thanx for any help
-lharp-
_________________
aurius media studio
http://www.aurius.sk
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: Jason Sheets: "Re: [PHP] RSA implementation"
- Previous message: Rob Packer: "[PHP] Re: .htpasswd and PayPal generated passwords"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

