> For AI agents: the complete documentation index is available at https://rslint.rs/llms.txt, the full documentation bundle is available at https://rslint.rs/llms-full.txt.

# no-div-regex

[Added in v0.8.1](https://github.com/web-infra-dev/rslint/releases/tag/v0.8.1)
## Configuration


```ts title=rslint.config.ts
import { defineConfig, js } from '@rslint/core';

export default defineConfig([
  js.configs.recommended,
  {
    rules: {
      'no-div-regex': 'error',
    },
  },
]);
```

## Rule Details

Disallows equal signs explicitly at the beginning of regular expression literals, since `/=` at the start of a regular expression can be visually confused with a division-assignment operator.

Examples of **incorrect** code for this rule:

```javascript
function bar() {
  return /=foo/;
}
```

Examples of **correct** code for this rule:

```javascript
function bar() {
  return /[=]foo/;
}
```

## Original Documentation

- [ESLint: no-div-regex](https://eslint.org/docs/latest/rules/no-div-regex)
- [Source code](https://github.com/eslint/eslint/blob/v10.8.1/lib/rules/no-div-regex.js)
