[TxMt] Regex to indent new lines between tags

Mike Stickel mike at screenflicker.com
Sun Jun 10 16:04:05 UTC 2007


On Jun 10, 2007, at 1:57 AM, Allan Odgaard wrote:
>> For a project I'm working one I'm trying to figure out a way to  
>> tab indent new lines of code between certain tags (mainly <head>  
>> and <body>). Unfortunately I'm not as good at regular expressions  
>> as I thought I was and can't figure it out.
>>
>> Anyone out there able to lend a hand?
>
> Exactly when do you want what to happen?
>
> If you have the following:
>
>     <head>
>     bla bla
>     </head>
>
>     <body>
>     bla bla
>     </body>
>
> Then select it and use Text → Indent Selection (⌥⌘[]) then you  
> get:
>
>     <head>
>         bla bla
>     </head>
>
>     <body>
>         bla bla
>     </body>
>
> Is this the functionality you are after?

That's what I have been doing but I was wondering if there was a way  
to do it with the search and replace dialog using regular expressions  
to replace all the \n with \n\t to get that indent

Mike Stickel
http://screenflicker.com/mike/ | http://gonecksgo.com




More information about the textmate mailing list