January 30, 2021
Here's how you can use regex in JavaScript to remove double spaces:
const string = 'Here is my sentence. There are double spaces.'
const newString = string.replace(/ {2,}/g, ' ')
This regex replaces any two or more spaces in a row with a single space.
Tufts Meal Plan Wrapped
Mar 2, 2024
Building an e-ink picture frame that displays an iCloud photo album
Jan 9, 2024
2023 in review
Jan 5, 2024
Subscribe to my newsletter for a monthly round-up of new blog posts and projects Iām working on!