Showing posts with label regex. Show all posts
Showing posts with label regex. Show all posts

Friday, February 2, 2024

regex to swap 2 columns of a csv

cliptools new update with smartfiles is amazing.
Ive got cliptools running 2 buffers deep.
enabled global paste in settings for cmd shift c to paste from smart file. my smartfile is {clip:1},{clip:2}(then newline).
I use this to quickly grab urls and titles to create links for my website.
my website runs a bunch of javascript that dynamically generates tables with links inside them from the csv.
By using cliptools I can grab all the links at once and as long as I stay consistant with copying the title,then the link its fine. if they end up backwards, it's not a big deal. Being consistent is the most important because I can easily use a regex to fix it.

my regex to fix it

:%s/\v([^,]+),([^,]+)/\2,\1/g

Monday, November 13, 2023

Thursday, November 9, 2023

Strip Blank Lines In Vim

Heres the regular expression you would use in vim to delete all those blank new lines you dont want that are needlessly taking up space in your text file.


  :g/^$/d