---
title: "lint/performance/prefer-explode-over-preg-split"
pagination: false
---

{/* Generated by scripts/gen-rule-docs.py. Edit mapping.toml, not this file. */}

<RuleId id="lint/performance/prefer-explode-over-preg-split" />

In the [`code-quality`](/docs/rules/sets/code-quality) set. Safe fix.

## What it does

Detects calls to `preg_split()` whose pattern has no regex meta-characters and no modifiers, which means the split could be done with `explode()`.

## Configuration

```toml title="pun.toml"
[lint.rules]
"performance/prefer-explode-over-preg-split" = "error"
```

To skip it in some files or lines, add an [override](/docs/configuration/pun-toml#lint) or an [ignore comment](/docs/configuration/ignore-comments).

## Replaces

- [`Pun/prefer_explode_over_preg_split`](https://mago.carthage.software/1.61.0/en/tools/linter/rules/) (pun)
- [`prefer-explode-over-preg-split`](https://mago.carthage.software/1.61.0/en/tools/linter/rules/#prefer-explode-over-preg-split) (mago-linter)

[More lint/performance rules](/docs/rules/lint/performance) · [Edit this page](https://github.com/shipfastlabs/pun/edit/main/crates/pun-config/rules/mapping.toml)
