JavaScript: String Methods for RegExp

By Xah Lee. Date: . Last updated: .

RegExp is used for matching text patterns.

There are 2 ways to use RegExp in JavaScript:

Following are string methods for regex.

String.prototype.search

Get the index of first char of matched string.

〔➤see JavaScript: String.prototoype.search

String.prototype.match

Get a array of captured groups, or, get array of all occurances.

〔➤see JavaScript: String.prototoype.match

String.prototype.replace

Get a new string.

〔➤see JavaScript: String.prototoype.replace

RegExp Topic

  1. JavaScript: RegExp Tutorial
  2. JavaScript: String Methods for RegExp
  3. JavaScript: RegExp Object
  4. JavaScript: RegExp Constructor
  5. JavaScript: RegExp.prototype
  6. JavaScript: RegExp Syntax

String Topic

  1. JavaScript: Default Charset/Encoding
  2. JavaScript: String is 16-Bit Unit Sequence
  3. JavaScript: Unicode Character Escape Sequence
  4. JavaScript: Allowed Characters in Identifier
  5. HTML: Allowed Characters in id Attribute
  6. HTML: Character Sets and Encoding
  7. HTML XML Entities

  1. JavaScript: Template String
  2. JavaScript: Convert String to Number
  3. JavaScript Encode URL, Escape String
  4. JavaScript: Format Number
  5. JavaScript: JSON Object

  1. JavaScript: String Object
  2. JavaScript: String.prototype
  3. JavaScript: String Constructor
Like what you read? Buy JavaScript in Depth
or, buy a new keyboard, see Keyboard Reviews.