[thelist] [ColdFusion] More RegEx Fun

.jeff jeff at members.evolt.org
Tue Feb 25 18:33:38 CST 2003


hey all,

i had such good luck with my last regex questions here that i thought i'd
ask some more.

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.

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

this brings up an interesting issue though.  ponder this example:

<a href="download.html"
   onmouseover=rollOver("download", "on")
   onmouseout=rollOver("download", "off")>

obviously, as soon as i wrap the event handlers with quotes the function
calls will break (and most likely throw errors every time the page is loaded
or worse every time the affected links are moused over).

finally, i'd like to be able to enforce case on tags and tag attributes,
converting it to lowercase across the board.  obviously this becomes a whole
lot easier if i've already wrapped attribute values in quotes so i can be
sure to avoid lower casing attribute values unnecessarily.

any thoughts?

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/






More information about the thelist mailing list