100 Days of Code: Day 41

Home / Technology / Web Development / 100 Days of Code: Day 41
I spent some time today working with regular expressions in JavaScript and (unsuccessfully) fighting off a medicine-induced slumber.

[vc_row css=”.vc_custom_1526680382655{margin-top: 15px !important;margin-bottom: 60px !important;padding-right: 10% !important;padding-left: 10% !important;}”][vc_column][vc_progress_bar values=”%5B%7B%22label%22%3A%22Progress%22%2C%22value%22%3A%2241%22%2C%22color%22%3A%22blue%22%7D%5D” title=”100 Days of Code, Round 1″ percentage_value=”27″ title_color=”#3e3e3e” bar_color=”#1b7da9″ track_height=”20px” track_color=”#e7f6fc” m=”20″ extra_class=”” units=”%”][/vc_column][/vc_row][vc_row][vc_column][vc_custom_heading text=”Goals For Today:” font_container=”tag:h3|text_align:left” use_theme_fonts=”yes”][ultimate_icon_list icon_size=”16″ icon_margin=”20″][ultimate_icon_list_item icon_type=”custom” icon_img=”id^4091|url^https://www.blissfullemon.com/wp-content/uploads/2018/05/done.png|caption^null|alt^null|title^done|description^null”]Complete the Regular Expressions challenges at FCC[/ultimate_icon_list_item][/ultimate_icon_list][vc_custom_heading text=”The Good:” font_container=”tag:h3|text_align:left” use_theme_fonts=”yes”][vc_column_text]I completed the Regular Expressions challenges at Free Code Camp. I got a little nervous when I got to some of the more challenging exercises, like verifying the username using the rules specified, but was pleasantly surprised that I figured it out in just a few minutes.

The Rules:
  1. The only numbers in the username have to be at the end. There can be zero or more of them at the end.
  2. Username letters can be lowercase and uppercase.
  3. Usernames have to be at least two characters long. A two-letter username can only use alphabet letter characters.

My Outcome:

let userCheck = /^wD+w*d*$/;

I’m sure there is a more efficient way than how I chose to do it, but this seemed the most logical way to piece it together in my mind. What changes would you make?[/vc_column_text][vc_custom_heading text=”The Bad:” font_container=”tag:h3|text_align:left” use_theme_fonts=”yes”][vc_column_text]My only real complaint is that it’s allergy season and I am realizing that the allergy medicine I have been taking is produced and/or endorsed by the devil.


Let's chat!

%d bloggers like this: