🔰group

capturing or non-capturing groups

JSvalueobjectregexpattern ⟩ group

(...)	        // unnamed capturing group
(?<name>...)	// named capturing group
(?:...)	        // non-capturing group
(...|...|...)	// alternation

\N	        // match the text in unnamed capture #N.
\<name>	        // match the text in named capture “name”.

//                      ╭─#1──╮   ╭╮ <--- same as capture #1
const regex = /(?:\d{2})(\d{3})\d+\1/;
//             ╰───────╯ non-capturing group
//   ╭1╮    ╭1╮
   001234004123567
// ╰───match───╯
// ╰╯ non-capturing group

Last updated