---
description: capturing or non-capturing groups
---

# group

[JS](../../../..) ⟩ [value](../../..) ⟩ [object](../../../obj) ⟩ [regex](..) ⟩ [pattern]() ⟩ group

{% hint style="success" %}
```javascript
(...)	        // 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
```
{% endhint %}

{% tabs %}
{% tab title="🔴 主題" %}
* [capturing-group](group/capturing-group "mention")
  * [named-group](group/capturing-group/named-group "mention")
{% endtab %}

{% tab title="💈範例" %}
* [parse-.ini-file](../ex/parse-.ini-file "mention") - named group
* [quick-brown-fox](../ex/quick-brown-fox "mention") - named group
{% endtab %}

{% tab title="📗 參考" %}
* [ ] JS.info ⟩ [Capturing groups](https://javascript.info/regexp-groups)
* [ ] [Regular Expression Quick Reference](http://regexrenamer.sourceforge.net/help/regex_quickref.html)
{% endtab %}
{% endtabs %}
