How To Learn Quickly (ft. Regex and Anki)

Tools
- To practice:
- Cheat sheet: https://www.rexegg.com/regex-quickstart.html
- Anki: https://apps.ankiweb.net/
How to
There are two parts to get good at something. Learn it and remember it.
Anki will help us with the second part. Remember learning doesn’t mean you need to you have to first learn all the concept and then move to practice. Learn by practice.
What is Anki?
https://apps.ankiweb.net/
Anki is a program which makes remembering things easy.
Using spaced repetition, a technique from cognitive science for fast and long-lasting memorization.
Refer the ANKI website for more info.
Refer this video to know more: https://www.youtube.com/watch?v=WmPx333n5UQ
Note: We are not going to go through all the syntax of regex but start by practicing the approach.
How to approach regex
There are two main approaches you can use after observing the string pattern
1. What to match
2. What not to match
Ex:
String: 20-10-2020
Q: Write a regex to get the day i.2. value 20.
1. What to match.
Ans: From the start match the numbers.
From the start gives us
^
Match the numbers gives us
\d+
   or 
[0-9]+
Which makes our final answer
^\d+
2. What not to match.
Ans: From the start continue until you see hyphen
-
 .
From the start gives us
^
Until you see hyphen can be substituted as
[^-]+
Which makes our final answer as
^[^-]+
Always choose the approach which seems more robust and easier to look at and understand.
Matching vs capturing
Reference: https://www.rexegg.com/regex-style.html
Matching regex exactly can become hard, feel free to use capture groups.
Ex:
String:
“Name:- john doe
Place:- USA”.
Q: Write a regex to get the name value i.e. “john doe” which can be variable.
Ans:
Here we have to use the property “Name” to get the value of name, in order to do it we will use capture groups i.e. match other characters and use them as reference.
Name:-([^\n]+)
We have the answer in capture group 1.
What to do next?
Start building your Anki deck.
Use these references to get practice questions.
You may not have to solve the question but get an answer for the question. We will use them to create our Anki deck.
Recommend watching the video and learn more about Anki before starting
to build deck.
https://www.youtube.com/watch?v=WmPx333n5UQ
1. Create a new deck

2. Add a new card.

3. Once you have added a card click on study now.
After checking the answer make sure select how hard the question was. Depending on your response Anki will remind you of the question at certain period of time.

4. Continue to build a proper deck. And keep checking Anki everyday to see if you are required to read any deck or not.
There are decks created by good people which are free to download and import in Anki. Though creating your own deck is what I would suggest at first.
Ex: https://ankiweb.net/shared/info/284568815
Anki Reference Videos
- Anki guide: https://www.youtube.com/watch?v=WmPx333n5UQ
- Create Anki Decks Quickly Using CSV: https://www.youtube.com/watch?v=w_gieyVnKXs

This Post Has 0 Comments