less than 1 minute read

I was doing a problem today that required me to extract the number from a URL in javascript. After some research, it seemed Regex was the best way to accomplish the task. I then soon realized I had to do some review on regular expressions and how they work. So, I decided to do the hackerrank problems at https://www.hackerrank.com/domains/regex so that I can leverage the power of regular expressions for any future tasks. I have done many of the ‘easy’ difficulty problems so far and I already feel a lot more comfortable with using regex.

Going back to the the problem, I had to use the $ anchor in the regex string. I needed to extract a number towards the end of the URL and therefore using character classes with the $ anchor helped me accomplish the task.