Haven't tested this, but something like:
preg_replace_all('#<([^>]+?\w+)=([^"\'\s]+)#', '<$1="$2"', $string), 
potentially run multiple times.
On 28/06/2011, at 10:17 AM, [email protected] wrote:

> Hi All,
> 
> I need to fix up some sloppy HTML which is (in some cases) missing quotes 
> around the HTML attributes.
> 
> eg <img src=filename.jpg width=100 height=100>
> 
> Does anyone have a tested regex sitting in their collection for adding back 
> in those missing quotes?
> 
> Thanks,
> 
> Harvey.
> 
> -- 
> Harvey Kane
> 
> Phone:
> - Auckland: +64 9 950 4133
> - Wanaka: +64 3 746 8133
> - Mobile: +64 21 811 951
> 
> Email: [email protected]
> If you need to contact me urgently, please read my email policy 
> www.ragepank.com/email/
> 
> -- 
> NZ PHP Users Group: http://groups.google.com/group/nzphpug
> To post, send email to [email protected]
> To unsubscribe, send email to
> [email protected]

---
Simon Welsh
Admin of http://simon.geek.nz/

-- 
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]

Reply via email to