## 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.cognigy.com/ai/agents/develop/node-reference/ai/regex-slot-filler) Node.

**Parameters:**

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

### IRegexSlotFillerParams Object Structure

```
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

```
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);
```
