Finding all numbers that are bigger than 1 in vim

2009-12-24 138 words 1 min read

/^([2-9]d*|1d+)
If we have a csv like structure

The trick here is simple, lets look at the regex from the begining:

^ – start from the begining
() – start and end of block
[] – digits within this. So we are looking from 2 to 9 to exclude the numbers begining with 1
d – search for digits

  • – search for one or more
    | – or operation
    1 – search for numbers begining with 1
  • – containing atleast one occurence or more.<h6 class="zemanta-related-title">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://sparksspace.blogspot.com/2009/10/adding-leading-zeros-in-excel.html">Adding Leading Zeros in Excel (sparksspace.blogspot.com)
  • <li class="zemanta-article-ul-li"><a href="http://blog.creativethink.com/2009/11/the-best-thing-about-2010.html">The Best Thing About &#8221;2010&#8221; (creativethink.com) <li class="zemanta-article-ul-li"><a href="http://www.revenews.com/jackbusch/google-goggles-the-world-is-your-hyperlink/">Google Goggles: The World is Your Hyperlink (revenews.com)
<div class="zemanta-pixie"><a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/e022d83e-669e-4cad-894c-cdab54a1946c/" title="Reblog this post [with Zemanta]"><img class="zemanta-pixie-img" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/reblog_e34.png" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related more-info pretty-attribution paragraph-reblog">

author

Authored By Amit Agarwal

Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.

We notice you're using an adblocker. If you like our webite please keep us running by whitelisting this site in your ad blocker. We’re serving quality, related ads only. Thank you!

I've whitelisted your website.

Not now
This website uses cookies to ensure you get the best experience on our website. Learn more Got it