Possible Duplicate:
RegEx match open tags except XHTML self-contained tags
I would like to ensure that HTML attributes have quotes around them as is required by xhtml.
For example:
<BODY link=#0000ff vLink=#开发者_如何学Go800080>
should be
<BODY link="#0000ff" vLink="#800080">
I am looking for a Regex pattern that would handle this.
Thanks
Whilst not an exact duplicate, the basic answer is the same.
What you want is not regex, but a DOM parser.
Please specify your server side language. Or do you intend to do this with JavaScript? If so, there is not much point.
A suggestion too, if you are doing that to make it valid XHTML, then you should probably know the body element (and all the elements and attributes) are used in lowercase.
精彩评论