Yeah, except you'd still have to do something about <a name> tags,
crummy code (such as <b>some text<br><br></b>), and probably other
false positives, too.
--
Greg Raven
Apple Valley, CA
Illegal immigration is a weapon of mass destruction.
On Oct 15, 2007, at 2:47 PM, Roland Küffner wrote:
Am 15.10.2007 um 23:09 schrieb Greg V. Raven:
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.
taking the next step to perfection, you could use a negative
lookahead assertion (see the manual) in order to exclude script-
tags. As you have persistant includes your file might look
something like this:
<!-- #bbinclude "some:path:to:script.incl" -->
<script src="one.js" type="text/javascript">
</script>
<script src="two.js" type="text/javascript">
</script>
<!-- end bbinclude -->
now search this:
<([a-zA-Z]+)[^>]*?>\s*</\1>(?!\s*<script|\s*<!-- end bbinclude)
This would only find empty tags only if they are not followed by
another opening script tag or a closing bbinclude comment.
-Roland
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]>
--
------------------------------------------------------------------
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]>