La Coctelera

Refugio VirtuaMental de un Internauta

18 Marzo 2009

Using Regular Expressions in search and replace with Vim

This evening I've learned to use regular expressions in sql code, and I'm loving it. Talking with GoLo about this, he showed me how to use regular expressions on the Vim´s search and replace tool (Instead he doesn't like Vim :P). E.g. If you want to comment some lines of code, you may want to use:

[sourcecode language='css']
:4,9 s/^/\/\/ /g
[/sourcecode]

Where 4 and 9 are the lines between which you want to comment on the code, ^ is what you must use to go to the begin of the lines and \ allow us to insert the /. This would be more efficient if you record it into a macro.

This is a very extensive topic, and this is only a minimal part of it. If you want to learn more about it, you can  read this tutorial.

servido por eckelon 2 comentarios compártelo

2 comentarios · Escribe aquí tu comentario

GoLo

GoLo dijo

Sin título

Wow! an English post... U are pro, dude!

18 Marzo 2009 | 11:42 PM

Bitacoras.com

Bitacoras.com dijo

Sin título

Información Bitacoras.com...

Valora en Bitacoras.com: This evening I?ve learned to use regular expressions in sql code, and I?m loving it. Talking with GoLo about this, he has show me how to use regular expressions on the Vim´s search and replace tool (Instead he doesn?t like Vi....

19 Marzo 2009 | 12:20 AM

Escribe tu comentario


Sobre mí

Avatar de eckelon

Refugio VirtuaMental de un Internauta

madrid, España
ver perfil »
contacto »

Fotos

eckelon todavía no ha subido ninguna foto.

¡Anímale a hacerlo!

Buscar

suscríbete

Selecciona el agregador que utilices para suscribirte a este blog (también puedes obtener la URL de los feeds):

¿Qué es esto?

Crea tu blog gratis en La Coctelera