Curriculum
Course: JavaScript Basic
Login

Curriculum

JavaScript Basic

JSHome

0/216
Text lesson

JS RegExp

A regular expression is a string of characters that defines a search pattern. This pattern can be used for searching and replacing text.

What Is a Regular Expression?

A regular expression is a sequence of characters that defines a search pattern. You can use this pattern to specify what you’re looking for when searching through text. Regular expressions can range from a simple single character to more complex patterns. They are commonly used for various text search and replace tasks.

Syntax

/pattern/modifiers;

Example

/code7school/i;

Example explained:

·         /code7school/i is a regular expression.

  • “code7school” is the pattern to be searched for.
  • “i” is a modifier that makes the search case-insensitive.