[Project_owners] Help with a regular expression?
lid2000 at tpg.com.au
Sat Sep 3 18:08:11 EDT 2005
What I'm trying to do is fix nonclosing HTML tags, so they're XHTML
compatible. Here's what I'm using:
text = text.replace(/<(br|hr|img)([^>]*)([^\/])>/gi, "<$1$2$3 />");
This works, so long as there's a space before the end of the tag. I've
been trying all afternoon, but I can't come up with one that satisfies
<hr style="something: blah;" class="somethingelse">
<img src="http://blahblahblah" />
I thought I had it a few times, but the / in http:// kept screwing me
up. If anyone wants to give it a go, it'd be much appreciated.
More information about the Project_owners