Posted by Mike Collins on 08/23/06 03:01
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
----------------------------
supposed to do:
- strip alt attribute from img tag
almost works:
- fails on empty alt tag (e.g. alt="")
looking for a few good ideas. thanks.
Navigation:
[Reply to this message]
|