Oct
10
2005

Vim: Converting HTML List items to OPML

I was trying to convert a long list of html items to an OPML file. The regex refused to work, and after a quick chat with the nice people in #vim, it turns out that I wasn’t escaping my parenthesis.


:%s/<li><a href="\(.*\)">\(.*\)< \/a><\/li>/<outline text="\2" url="\1">/

I found the escaping a bit counter-intuative… like the rest of vim is so intuative ;)

Written by Aaron Wormus in: General, VIM |

4 Comments »

  • yeah, i dislike having to escape my greedy plus signs \(.\+\) too. however, it starts to kinda-sorta make sense when you consider whether or not you would *usually* be actually looking for literal parantheses or plus signs when using search in a text editor such as vim.

    i wish there was a choice. oh wait, it’s vim. there probably is. i can’t be bothered to find out how to change it though.

    Comment | 11/10/2005
  • Rod Daunoravicius

    There IS a choice and I use it all the time: just put \v (”very magic”) at the beginning of the regex and you won’t have to worry about escape parentheses, pipes or curly braces (unless you want them as literal characters).

    Comment | 2/8/2006
  • free porn video…

    exellent…

    Trackback | 26/7/2007
  • updatedfreeporn.com’s multi award winning adult site offers daily & weekly updated free porn for every niche & desire.free porn pics,free porn videos,free …

    Comment | 21/2/2008

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes