# biome complexity/noAdjacentSpacesInRegex: fix changes program behavior

Internal evidence sheet generated by fixhunt. Not an issue text. A human re-verifies, checks the duplicates
below, and writes the upstream report in their own words following the project's AI policy.

- Tool: biome 2.5.15
- Rule: complexity/noAdjacentSpacesInRegex (tool labels the fix: safe, this fix reported as safe)
- Oracle: fix-changes-behavior
- Judge (Nemotron 3 Ultra, advisory): introspection-only, severity low. The fix rewrites the regex literal from /a  b  c/ to /a {2}b {2}c/, which changes the value of RegExp.prototype.source. The program only inspects this source text by splitting on spaces and counting them, so the behavioral difference is purely introspection of the rewritten literal itself.
- Program: minimized from 2 to 2 lines

## Reproducer

```js
const re = /a  b  c/;
console.log(re.source.split(' ').length - 1);
```

## Commands

```sh
node prog.js
bunx @biomejs/biome lint --only=complexity/noAdjacentSpacesInRegex --write prog.js
node prog.js
```

## Observed

```
stdout before:
4
stdout after:
2
```

## Diff applied by the fix

```diff
--- orig.js	2026-10-22 13:25:34.370120674 -0400
+++ fixed.js	2026-10-22 13:25:36.421154565 -0400
@@ -1,2 +1,2 @@
-const re = /a  b  c/;
+const re = /a {2}b {2}c/;
 console.log(re.source.split(' ').length - 1);
```

## Why the rewrite is not equivalent (model draft, verify before use)

The original regex literal `/a  b  c/` contains two spaces between each letter; its `.source` property returns the exact string `"a  b  c"`. Splitting this on single spaces yields `["a", "", "b", "", "c"]`, length 5, minus 1 gives 4. The rewritten regex `/a {2}b {2}c/` uses the quantifier `{2}` to match exactly two spaces, but its `.source` is `"a {2}b {2}c"`. Splitting that on spaces produces `["a", "{2}b", "{2}c"]`, length 3, minus 1 equals 2. Thus the change alters the literal text of the regex source, affecting the subsequent string operation and output.

## Upstream search

Queries: "noAdjacentSpacesInRegex fix", "complexity noAdjacentSpacesInRegex regex literal", "regex adjacent spaces curly braces replacement", "Biome lint rule spacing in pattern"

- duplicate: https://github.com/biomejs/biome/issues/11419
  same rule noAdjacentSpacesInRegex corrupting regex by replacing spaces with quantifiers, same defect class
- related: https://github.com/biomejs/biome/issues/6670
  lists complexity/noAdjacentSpacesInRegex among many rules but no specific defect

<details><summary>All hits</summary>

- [github, open] 💅 noDuplicateTestHooks: false positive on a local function named `before` called twice in a test — https://github.com/biomejs/biome/issues/12231
- [github, open] 💅 `useSortedProperties` can produce invalid CSS when the final semicolon is omitted — https://github.com/biomejs/biome/issues/12417
- [github, closed] 💅 `noAdjacentSpacesInRegex` safe fix corrupts character classes: `[\s   ]` → `[\s {3}]` — https://github.com/biomejs/biome/issues/11419
- [github, open] 💅 `useSortedProperties` moves Sass variable declarations below their uses — https://github.com/biomejs/biome/issues/12414
- [github, open] 💅 `useSortedProperties` can change behavior when reordering nested CSS rules — https://github.com/biomejs/biome/issues/12413
- [github, open] 💅 `noUnnecessaryConditions`: false positive on an overloaded call with `undefined` as the default argument (Vue `inject`) — https://github.com/biomejs/biome/issues/12040
- [github, open] 💅 `noSkippedTests` conditionally skip fix suggestion — https://github.com/biomejs/biome/issues/9295
- [github, open] 💅 Actually used private method considered unused — https://github.com/biomejs/biome/issues/8185
- [github, open] 💅 cannot detect that the StrictMode component of React is being exported. — https://github.com/biomejs/biome/issues/10609
- [github, open] 💅 noUnnecessaryConditions callback overload false positive — https://github.com/biomejs/biome/issues/11439
- [tavily] 💅 `noThisInStatic` safe fix is not safe · Issue #10011 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/10011
- [tavily] 💅 `useReadonlyClassProperties` want to add readonly on javascript files · Issue #7301 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/7301
- [tavily] 💅 Corrupted CLI safe fix for `useConsistentArrowReturn` · Issue #8347 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/8347
- [tavily] 💅 Incorrect suspicious/noAssignInExpressions on arrow function · Issue #8790 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/8790
- [tavily] 💅 `useSortedClasses` unsafe fix does not apply to expressions in Astro template · Issue #9181 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/9181
- [tavily] 🐛 $filename metavariable not set in GritQL plugins · Issue #6670 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/6670
- [tavily] Property 'useIterableCallbackReturn' is not allowed, (same for `useUniqueElementIds`) · Issue #7280 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/7280
- [tavily] 💅 noParametersOnlyUsedInRecursion false positives · Issue #8004 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/8004
- [tavily] 💅 correctness/noPrecisionLoss incorrectly flags hex literals above or equal to 2^53 even if valid · Issue #8145 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/8145
- [tavily] 💅 Linter: `lint --write` is not idempotent on Astro frontmatter, while `lint` reports no issues · Issue #7912 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/7912
- [tavily] 💅 useExhaustiveSwitchCases does not work across module boundaries · Issue #6929 · biomejs/biome · GitHub — https://github.com/biomejs/biome/issues/6929
- [github, closed] 📝 `test.each(...)` arguments not wrapped, overflowing `lineWidth` (2.3.6 regression) — https://github.com/biomejs/biome/issues/10727
- [github, closed] Removes parentheses in generators by mistake — https://github.com/biomejs/biome/issues/10697
- [github, closed] json formatter always fail in ci (GHA) but fine in local (specifically error on `biome.json`) — https://github.com/biomejs/biome/issues/8128
- [github, closed] ☂️ CSS Formatter — https://github.com/biomejs/biome/issues/1285
- [github, closed] 📝 Ignore option not respected — https://github.com/biomejs/biome/issues/3345
- [tavily] feat(migrate): some more migration metadata by dyc3 · Pull Request #9016 · biomejs/biome · GitHub — https://github.com/biomejs/biome/pull/9016
- [tavily] feat(lint): add noUselessCall rule by realknove · Pull Request #10237 · biomejs/biome · GitHub — https://github.com/biomejs/biome/pull/10237
- [tavily] feat(lint/nursery): new rule - noInvertedTernary by js2me · Pull Request #9312 · biomejs/biome · GitHub — https://github.com/biomejs/biome/pull/9312

</details>
