Regular Expressions
Regular Expressions (regex) are powerful patterns used to match character combinations in strings. Great for searching and validation.
Regex Syntax
Regex patterns are enclosed in slashes /pattern/. The test() method returns true if a match is found.
Replacing with Regex
You can use regex with string replace() to replace all occurrences (using the g global flag).
Practice
Challenge 1: Write a regex to check if a string contains only numbers.