Hi Patrick,
It didn't do what I thought it would, but there were some technics that are new 
to me.

I've already done a regex to fix links, lowercase tags, remove illegal spaces, 
quoted attributes, and pulling the closing tag in so it stops a tick with old 
IE5 browsers.

I split it up, and as James suggested a while ago, used a few different regexs 
to do the job.

I'm going to go with Mike's "per char" way, as I think it will be more 
configurable.
Thanks anyway, Bob.


----- Original Message ----- 
From: "Patrick Bierans" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Sunday, July 31, 2005 8:41 PM
Subject: Re: [php-list] Lowercase problem

Look at this:

<?php
  $code=' <a href= noop.HTML>    <IMG   SRC = BLIND.gif height=0 width= 
"11">  </a>';

  $code=preg_replace("/<([a-z0-9]+)/mi",'<'.strtolower("\\1"),$code);
  $code=preg_replace("/\s*([a-z0-9]+)\s*=\s*\"?\s*([^ >\"]+)\s*\"?\s*/mi",' 
'.strtolower("\\1").'="\\2"',$code);

  echo htmlentities($code); // just for output - don't use in-code
?>



------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12huuokt3/M=362131.6882499.7825260.1510227/D=groups/S=1705005703:TM/Y=YAHOO/EXP=1122850867/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org
">Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life 
- brought to you by One Economy</a>.</font>
--------------------------------------------------------------------~-> 

Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to