Collab Lab Week 4 - Tuesday

nikema

Nikema

Posted on January 8, 2020

Collab Lab Week 4 - Tuesday

I'm tired so I'll keep it very short today. Tuesdays are park days for my kids and me so I don't tend to be very productive on this day. At least the afternoon and evening is dedicated to park day.

As far as progress on the user story goes, I did some thinking, some doc reading, some video watching, and a tiny bit of playing with code. We need to check the user input for duplicates in the database and part of that task means stripping punctuation from the input and normalizing capitalization. My mind instantly went to RegEx when I saw the acceptance criteria.

I kind of have a fear of regular expressions but I also knew this would be an easily googleable problem to solve. I played with some inputs and RegEx in my node REPL.

This is what I came up with:

input = input.replace(/[^a-zA-Z\s]/g, "").toLowerCase()
// will strip out all non-letters except whitespace, then lowercase the string

The only problem is if a user puts in extra spaces for some reason those spaces don't get trimmed.

node REPL

I'm meeting again with Mike tomorrow. At least I'll be able to show I've been thinking about how to approach the problem. I also posted the links I looked at today to the wiki.

đź’– đź’Ş đź™… đźš©
nikema
Nikema

Posted on January 8, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related