[thelist] [ColdFusion] More RegEx Fun

Joshua Olson joshua at waetech.com
Thu Feb 27 09:04:03 CST 2003

----- Original Message -----
From: ".jeff" <jeff at members.evolt.org>
Sent: Tuesday, February 25, 2003 7:30 PM

> let's say i have some tags i want to enforce trailing slashes on.  for
> example:
> <br>
> <img src="images/foo.gif">
> <input type="submit" value="Continue >>>">
> how would i go about doing that?
> notice that last one is a doozy and may ultimately make this next to
> impossible with regex.  i'm hoping someone here can prove me wrong.


I'm sure some smarty will try to break this code... please do.  I used the
XHTML 1.0 reference for the definitions to a certain extent.  For example,
the spec does call for limitations as to which characters may be in
attribute values.  The regex's I created do not since I was trying to cater
the results to .jeff's example.  I deviated for simplification in a couple
other places as well, but I hope that these rules will catch most common
derivations of tags.

> next, i'd like to enforce tag attribute quoting.  if any attributes are
> found unquoted, wrap them with double-quotes.

I'll see what I can figure out.


More information about the thelist mailing list