> ## Documentation Index
> Fetch the complete documentation index at: https://docs-classic.cognigy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# setRegexSlot

## Syntax

`setRegexSlot(params)`

## Description

Extracts Slots from user inputs using a regular expression and writes them to `input.slots`. This function is used by the [Regex Slot Filler](https://docs-classic.cognigy.com/ai/agents/develop/node-reference/ai/regex-slot-filler.md) Node.

**Parameters:**

* `params`: `IRegexSlotFillerParams` – a configuration object with regex, flags, and Slot information.

> [accordion] IRegexSlotFillerParams Object Structure
>
> ```js theme={null}
> export interface INodeExecutionCognigyObject extends IExecutionObjects {
>     api: INodeExecutionAPI;
> }
>
> export type TNodeChildConfigs = {
>     id: string;
>     type: string;
>     config: {
>         [key: string]: unknown
>     };
> };
>
> export interface ICognigyNodeFunctionParams {
>     cognigy: INodeExecutionCognigyObject;
>     childConfigs: TNodeChildConfigs[];
>     config: object;
>     nodeId: string;
> }
>
> export interface IRegexSlotFillerConfig {
>     regex: string;
>     flags: string;
>     slot: string;
> }
>
> interface IRegexSlotFillerParams extends
>     ICognigyNodeFunctionParams {
>     config: IRegexSlotFillerConfig;
> }
> ```
>
> **Returns:** `Promise<void>`

## Example

```js theme={null}
const params: IRegexSlotFillerParams = {
  cognigy: {
    input: {
      text: "My ZIP code is 90210",
      // ...other Cognigy input properties
    },
    context: {},
    session: {},
    api: cognigyApi // typically injected by the platform
  },
  childConfigs: [],
  config: {
    regex: "\\b\\d{5}\\b",
    flags: "g",
    slot: "zipCode"
  },
  nodeId: "node-abc-123"
};

await setRegexSlot(params);
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.