|
Posted by Rik on 08/23/06 09:25
Mike Collins wrote:
> if (preg_match('/<\s*img/i',
> $row['text'])){ $row['text'] = preg_replace(
> '/<img\s*[^>]*alt=[\'"]([^\'"]*?)[\'"][^>]+>/iu', '$1',
> trim($row['text']) ) . ' (<b>IMG ALT</b>)';
> }
>
> regex isolated:
> ----------------------------
> /<img\s*[^>]*alt=[\'"]([^\'"]*?)[\'"][^>]+>/iu
> ----------------------------
-------------------------------------------^---^
There must be room after the closing tag, and having \s* and [^>]* together
is useless
> supposed to do:
> - strip alt attribute from img tag
>
> almost works:
> - fails on empty alt tag (e.g. alt="")
/<img[^>]*?alt=[\'"]([^\'"]*)[\'"][^>]*>/si
Grtz,
--
Rik Wasmus
Navigation:
[Reply to this message]
|