[TxMt] Re: The dreaded Regexp question

Matt Neuburg matt at tidbits.com
Fri Jul 3 21:20:25 UTC 2009


> On Jul 3, 2009, at 10:00 AM, Michael Newton wrote:
> 
>> Sorry, I know this isn't particularly on-topic (aside from the fact
>> that I'm using Textmate!) but I'm not having luck with the search
>> engines.
>> 
>> I have a bunch of HTML that needs to be converted to XHTML, notably
>> <input type="text"> needs to be <input type="text"/> which is easy
>> enough. Problem is, it's PHP so there are things like <input
>> type="<?php echo $type?>"> which I'm having troubles with. So how can
>> I create a regular expression that captures the guts of the HTML
>> brackets, while ignoring any PHP brackets it might come across inside
>> the HTML?

With that particular example, just passing the HTML thru HTML Tidy's HTML ->
XHTML conversion does the right thing. m.

-- 
matt neuburg, phd = matt at tidbits.com, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings






More information about the textmate mailing list