> For the complete documentation index, see [llms.txt](https://regex-simplify.lacostar.fr/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://regex-simplify.lacostar.fr/docs/global/rgb.md).

# rgb

{% tabs %}
{% tab title="Function types" %}

<pre class="language-typescript"><code class="lang-typescript"><strong>rgb(color: string): { 
</strong>    include: boolean, 
    matchs: RegExpMatchArray | null, 
    groups: Array&#x3C;{ 
        R: string | undefined,
        G: string | undefined,
        B: string | undefined,
        A: string | undefined
    } | null> | null
}
</code></pre>

{% endtab %}

{% tab title="Code example" %}
**Search rgb color in a string:**

<pre class="language-javascript"><code class="lang-javascript"><strong>const { global } = require('regex-simplify');
</strong>
const color = global.rgb(`
    rgb(12, 255, 56)
    rgba(12, 255, 56, 0.5)
`)

console.log(color);
</code></pre>

{% endtab %}

{% tab title="Function return" %}
**And here what return the function:**

```javascript
{
  include: true,
  matchs: [ 'rgb(12, 255, 56)', 'rgba(12, 255, 56, c0.5)' ],
  groups: [
    [Object: null prototype] {
      R: '12',
      G: '255',
      B: '56',
      A: undefined
    },
    [Object: null prototype] {
      R: '12', 
      G: '255', 
      B: '56', 
      A: '0.5' 
    }
  ]
}
```

{% endtab %}
{% endtabs %}
