[TxMt] [ANN] Select Balanced HTML Tag!!!1!

Alex Ross alex.j.ross at gmail.com
Tue Nov 20 22:48:38 UTC 2007

>> I don't mean to get all nerdy on you guys but the problem that  
>> you're running into here is that HTML is context-free.  Regular  
>> expressions can't match context free languages.  There are  
>> mathematical proofs of this... so what you're trying to do is  
>> really truly impossible.
>> What you need is someway to remember some state, which is the  
>> counter that Hans mentioned or a transformation of the tags so that  
>> each has a unique (ordered) identifier.  Also, you can match it if  
>> you have the recursive subexpression from Oniguruma.  But you  
>> don't.  My uh... suggestion is to give up using plain-old regular  
>> expressions :).  It can never work.
>> –Alex
> Hey, thanks. But duh ;)
> 	that's why the macro I just released actually works.
> 	I gave up on regex finally and mangled HTML around a bit to work  
> with the normal select brackets internal TextMate command.

oh.... uhm.  sorry.  didn't mean to insult.

> I was fiddling around with recursive regex, but it seems to  
> completely crash TextMate if you don't have it just right, so it's  
> extremely hard to play with.

More information about the textmate mailing list