---
title: "💭 Bob Belderbos on X: \"Forget Python for a sec, here's how Vim h..."
description: "!https://twitter.com/bbelderbos/status/1709525676154368055"
date: 2023-10-05
published: true
tags:
  - vim
  - regex
  - thought
template: link
---


<div class="embed-card embed-card-external">
  <a href="https://twitter.com/bbelderbos/status/1709525676154368055" class="embed-card-link" target="_blank" rel="noopener noreferrer">
    <div class="embed-card-content">
      <div class="embed-card-title">External Link</div>
      <div class="embed-card-meta">X (formerly Twitter) &middot; twitter.com</div>
    </div>
  </a>
</div>


I need to learn regex capture groups better.  This is so dang powerful. I really like the \v that bob uses here, it really does cut down on the terseness of all the special characters.

> I wanted to replace all occurrences of:
>
> name,name@example.com,0,171,,2023-09-21
>
> With:
>
> name,name@example.com
>
> Easy to do with Python, but what about a bit of > regex in Vim?
>
> :%s/\v([^,]+,[^,]+),.*/\1/

!!! note

    This post is a <a href="/thoughts/" class="wikilink" data-title="Thoughts" data-description="These are generally my thoughts on a web page or some sort of url, except a rare few don&#39;t have a link. These are dual published off of my..." data-date="2024-04-01">thought</a>. It's a short note that I make
    about someone else's content online <a href="/tags/thoughts/" class="hashtag-tag" data-tag="thoughts" data-count=2 data-reading-time=3 data-reading-time-text="3 minutes">#thoughts</a>
