Search⌘ K
AI Features

The exec Method

Explore the exec method of JavaScript's RegExp object. Understand how it searches within strings, manages global and sticky flags, updates lastIndex, and provides detailed match data including groups and indexes.

Using the exec method

The exec method executes a search in a specified string to the full extent of the expression. This means that if there are capturing groups, they’ll also be taken into account.

Just like with ...