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]>
