thoughts of the driverSteinn Eldjarn Sigurdarson on tech, tel, digital freedom and possibly his life..

August 4, 2009

Regexps in vim!

Filed under: General, Technology — Steinn E. Sigurðarson @ 1:27 pm

This took me like 10 minutes to get right. Just because of the slight differences between vim’s regexp and perl’s.

%s/context\["\([a-z]*\)"\]/context->\1/

However I need to this often when working with php, as more and more things seem to return stdClass objects (such as php5’s built-in json functions) and I always seem to write hundreds of lines of code assuming to use the formerly more common “smart arrays” of php. Syntactically though I must admit I much prefer the stdClass stuff.

digg this

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

gin 0.300 & tonic. | Powered by WordPress