loading...

Day 37 of 100DaysOfCode

arttupyykonen profile image Arttu Pyykönen ・2 min read

I've been taking a break from coding as I need to focus on my exams. I haven't finished them yet so I'm still not fully focusing on the 100DaysOfCode challenge. Still, I wanted to do some coding to not let all my skills rust away.

Today I read the rest of chapter 9 of EJS and did some freeCodeCamp challenges.

What I did today:

1. Read the rest of EJS CH9

https://eloquentjavascript.net/09_regexp.html

What I learned from it:

  • Using regular expressions more efficiently
  • How INI files are structured
  • How JavaScript regular expressions handle international characters

2. Challenges at FCC

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/

What I learned from it:

  • Using regex
  • Problem-solving

Time spent learning:

Task 'Reading_EJS'. Elapsed time: 30 min 45 s
Task 'FCC'. Elapsed time: 25 min 31 s

Total time: 56 min 16 s

Time spent is tracked by my TaskTimer script and the WakaTime app.

Links and videos

If you want a way to test your regular expressions I recommend these two sites:

  1. https://www.regexpal.com/
  2. https://www.debuggex.com/

I preferer the Regexpal as it's easier for me to understand

If you are wondering what are the most popular programming languages you can check this video from Tech with Tim.

Summary of Eloquent JavaScript CH9

"Regular expressions are objects that represent patterns in strings. They use their own language to express these patterns.

A regular expression has a method test to test whether a given string matches it. It also has a method exec that, when a match is found, returns an array containing all matched groups. Such an array has an index property that indicates where the match started.

Strings have a match method to match them against a regular expression and a search method to search for one, returning only the starting position of the match. Their replace method can replace matches of a pattern with a replacement string or function.

Regular expressions can have options, which are written after the closing slash. The i option makes the match case insensitive. The g option makes the expression global, which, among other things, causes the replace method to replace all instances instead of just the first. The y option makes it sticky, which means that it will not search ahead and skip part of the string when looking for a match. The u option turns on Unicode mode, which fixes a number of problems around the handling of characters that take up two code units.

Regular expressions are a sharp tool with an awkward handle. They simplify some tasks tremendously but can quickly become unmanageable when applied to complex problems. Part of knowing how to use them is resisting the urge to try to shoehorn things that they cannot cleanly express into them."

End of summary. You can find the original text from here

Outro
Thank you and see you all next time!

Discussion

pic
Editor guide