JavaScript Tutorial

The language for programming web pages.

JS RegExp

JavaScript Regular Expressions

A regular expression (RegExp) is a sequence of characters that forms a search pattern. RegExp can be used for text search and text replace operations.

Common Patterns:

  • \d — Digit (0-9)
  • \w — Word character (a-z, A-Z, 0-9, _)
  • \s — Whitespace
  • ^ — Start, $ — End
  • + — One or more, * — Zero or more
  • ? — Optional
  • | — OR

Try It Yourself

Edit the code below and click Run to see the result live.

Source Code
Result
Topics