Yep, this works, as does Roland's suggestion of:
<([a-zA-Z]+) ?[^>]*?>\s*</\1>
I was thinking in terms of positive finds, not negative finds, so I
just couldn't come up with the correct syntax.
Thanks to each of you.
Note to others that neither pattern is perfect, in that it finds
<script src="source.js" ...> </script> tags as well as true empty
tags, but each of my scripts is in an include, so I can temporarily
remove it from the page, kill all my empty tags, and then put the
script (and other) coding back into the page.
I've sent a feature request to BareBones that a "find empty tag" tool
be added to BBEdit, as I do a lot of code clean-up whenever I get a
new client.
--
Greg Raven
Apple Valley, CA
Illegal immigration is a weapon of mass destruction.
On Oct 15, 2007, at 1:40 PM, Ronald J Kimball wrote:
On Mon, Oct 15, 2007 at 11:58:12AM -0700, Greg V. Raven wrote:
OK, I'm stumped. I'm attempting to come up with a GREP pattern that
will find empty HTML tags. In building up to the full pattern, I've
found that this matches the start tag and the white space after it:
<([a-zA-Z]+) *.*?>\s*
The normal pattern for a closing tag seems to be:
</[a-zA-Z]+>
Given that I've captured the opening tag, it seems to me that the
pattern for the closing tag in my overall pattern should be:
<([a-zA-Z]+) ?.*?>\s*</\1>
However, while this pattern finds some empty tags, if I have nested
tags (empty or full), it finds the entire tag string, which is not
correct.
Any thoughts on what I'm missing?
Even though .*? is non-greedy, it can still match across a tag. I
think
you want something like this instead:
<([a-zA-Z]+)[^>]*>\s*</\1>
Ronald
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <[EMAIL PROTECTED]>
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <[EMAIL PROTECTED]>