# better-regex

Rule `unicorn/better-regex`. Removed. Prefer `eslint-plugin-regexp`

- Source: unicorn
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: no
- Deprecated: yes
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #1998 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `unicorn/better-regex` | no | no | package `eslint-plugin-unicorn` | [docs](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v80.0.0/docs/deleted-and-deprecated-rules.md#better-regex) |

## Enable it

### ESLint: `eslint.config.js`

```js
import unicorn from "eslint-plugin-unicorn";

export default [
  {
    plugins: { unicorn },
    rules: {
      "unicorn/better-regex": "error",
    },
  },
];
```

## Related rules

- [unicorn/comma-spacing](https://lintradar.dev/rules/unicorn/comma-spacing.md): Enforce consistent spacing before and after commas in JSON and SOML.
- [unicorn/comment-content](https://lintradar.dev/rules/unicorn/comment-content.md): Enforce better comment content.
- [unicorn/consistent-arrow-return-style](https://lintradar.dev/rules/unicorn/consistent-arrow-return-style.md): Enforce a consistent return style for multiline arrow function bodies.
- [unicorn/consistent-destructuring](https://lintradar.dev/rules/unicorn/consistent-destructuring.md): Use destructured variables over properties.
- [unicorn/consistent-function-style](https://lintradar.dev/rules/unicorn/consistent-function-style.md): Enforce function syntax by role.
- [unicorn/id-match](https://lintradar.dev/rules/unicorn/id-match.md): Require identifiers to match a specified regular expression.

---

Web page: https://lintradar.dev/rules/unicorn/better-regex. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
