About 2 hours
- 20 minutes for video walkthrough of slides
- 80 minutes for Independent Practice
- 20 minutes for checking understanding
- JavaScript 1 - Variables, Strings, Numbers Lesson
- JavaScript 2 - Arrays, Functions Lesson
- JavaScript 3 - Conditionals, Comparisons, Booleans Lesson
- JavaScript 4 - Loops Lesson
-
Regular Expressions allow you to search and modify strings using a special language. They are very powerful and can enable writing significantly less code.
-
Most online registration forms use RegEx to verify that the information entered is in the right format
-
Build/test tools match file names and extensions using regexes. For example, Jest uses regex to find test files ending in "test.js".
Participants will be able to:
- Read and write RegEx in JavaScript
- Use RegEx to test and replace strings
- Understand basic regular expression special characters:
.*+?\w\d
- JavaScript's RegExp syntax/structure
- Basic regular expression characters
- How RegExp modifiers work
- The 4 string methods and 2 RegExp methods that work with RegExps
Instructor demonstrates in the video walk through how to work with Regular Expressions in JavaScript.
- There are two ways to use RegEx: - RegEx as input to 4 String methods:
String.replace()
,String.match()
,String.search()
,String.split()
- String as input to 2 RegEx methods:RegExp.test()
,RegExp.exec()
- You can add modifiers to RegEx
- The pattern goes between the two forward slashes, and you can use back slashes to escape special characters
- There are a lot of complex RegEx patterns. We'll teach the basic ones, but there are many more you can learn as you go.
- Regular Interactive Visualizer and Tester
- Regex Testing Tool
- JavaScript Regular Expressions (MDN)
- JavaScript regexp object(TutorialsPoint)
- RegExp (Eloquent JavaScript)
- Go through the tutorial at https://regexone.com. Do at least lessons 1-10. This isn't JavaScript specific, but it will help you understand how to match text with regular expressions.
- Write a JavaScript function that takes a word and returns true if the word ends with
tonica
- Write a function expression that takes a string replaces all instances of
symantec
withsemantic
- Write a function that takes a string and deletes all words that end in
ing
- Write a function that takes a string and returns true if it is an email address. Compare your answer with your neighbor.
- Write a function that takes a string containing names separated by commas like
"Leah, Russell, Michelle"
and returns an array of names,["Leah", "Russell", "Michelle"]
- Write a regular expression that matches any Techtonica participant's first name, but not any staff members' first name.
- Write a regular expression that matches all even-length strings but not odd-length ones.
- Do lessons 11+ on https://regexone.com
- Make a cheat sheet to remind yourself about the different regular expression characters and how to use them.
- What character matches the beginning of the line?
- What does the 'i' flag mean and what is it used for?
- What does the dot ( . ) represent in Regex?
- What are the advantages and disadvantages of using regex?