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

# String: Explode to an array using a regular expression

> Explodes a string based on a supplied regex.

export const FormField = ({property, label, required = false, diType, uiPatterns, children}) => {
  const patterns = Array.isArray(uiPatterns) ? uiPatterns : uiPatterns ? [uiPatterns] : [];
  return <div style={{
    margin: '1.5rem 0'
  }}>
      <div style={{
    display: 'flex',
    alignItems: 'baseline',
    flexWrap: 'wrap',
    gap: '0.5rem',
    marginBottom: '0.25rem'
  }}>
        <strong>{label}</strong>
        <span style={{
    fontSize: '0.7rem',
    fontWeight: 600,
    textTransform: 'uppercase',
    letterSpacing: '0.04em',
    color: required ? '#6241f5' : '#6b7280'
  }}>
          {required ? 'Required' : 'Optional'}
        </span>
      </div>

      <div>{children}</div>

      {diType || patterns.length > 0 ? <p style={{
    fontSize: '0.85rem',
    color: '#6b7280',
    marginBottom: 0
  }}>
          {diType ? <>
              See the <a href={`/references/${diType}`}>{diType}</a> reference.{' '}
            </> : null}
          {patterns.length > 0 ? <>
              Accepts a <a href={`/documentation/placeholders-and-patterns/patterns#${patterns[0]}`}>pattern</a>.
            </> : null}
        </p> : null}
    </div>;
};

Splits a single piece of text into a list, using a search pattern to decide where to break it apart. This is the flexible version of splitting text: instead of one fixed separator, you describe the separator with a pattern, so you can break on "any run of spaces", "a comma or a semicolon", or any mix of characters at once. Use it when your separators are inconsistent, such as values divided by commas, semicolons, and stray spaces all in the same field.

This documentation describes: [Schema](/schemas/mapper/string-preg-split)

## Fields

<FormField property="pattern" label="Pattern" required>
  The search pattern that describes the separator, written as a regular expression (for example `/[\s,;]+/` to split on any run of spaces, commas, or semicolons). Whatever matches is treated as a separator and removed, leaving the pieces around it. You can build and test a pattern at [Regex101](https://regex101.com).
</FormField>

<FormField property="options" label="Options">
  Fine-tunes how the split behaves, through a set of on/off toggles. **No empty** (on by default) drops empty items, so back-to-back separators do not leave blanks in the list. **Capture delimiter** (off by default) keeps the matched separators as items in the result instead of discarding them. **Capture offset** (off by default) returns each item together with its character position in the original text.
</FormField>

<FormField property="limit" label="Limit">
  The maximum number of items to produce. When the limit is reached, the final item holds the entire remaining text. Leave it empty to split on every separator.
</FormField>

## Sample data

| Field   | Value                                  |
| ------- | -------------------------------------- |
| Pattern | `/[\s,;]+/`                            |
| Options | (defaults, so empty items are dropped) |

Input:

```json theme={null}
{ "tags": "red,  cotton ;summer" }
```

Output:

```json theme={null}
{ "tags": ["red", "cotton", "summer"] }
```

```json Configuration theme={null}
{
  "prototype": "string-preg-split",
  "parameters": {
    "pattern": "/[\\s,;]+/"
  }
}
```
