> ## Documentation Index
> Fetch the complete documentation index at: https://docs.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](/ai/agents/develop/node-reference/ai/regex-slot-filler) Node.

**Parameters:**

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

<Accordion title="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>`
</Accordion>

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