Regular Expressions Lab
Medium
3
16.4% Acceptance
In this lab, you will explore JavaScript's Regular Expression syntax and create a few different regular expressions. Regular expressions are useful when you need to search, match, or replace parts of a text or validate specific patterns within a string. JavaScript offers two ways to create regular expressions: Regular Expression Literal (/pattern/flags) and RegExp constructor (new RegExp(pattern, flags)).
You will learn to create and test regex by writing JavaScript code. By the end of this lab, you'll have hands-on experience with regex literals, RegExp constructors, and various regex flags.
Prerequisites
- Basic understanding of JavaScript syntax
- Familiarity with string manipulation in JavaScript
Objectives
- Create and use Regular Expression Literals
- Instantiate RegExp objects using the RegExp constructor
- Understand and use regex flags to modify match behavior