fabioc-aloha/alex_skill_mall/powershell-regex-backreference
- community
Checking that the SKILL.md file is still in the repository.
PowerShell regex backreference syntax pitfalls — dollar-sign escaping in replacement strings
Install
npx vskill@latest install fabioc-aloha/alex_skill_mall/powershell-regex-backreferenceSKILL.md
PowerShell Regex Backreference Ambiguity
Category: Cross-Platform Time Saved: 30+ minutes debugging "wrong capture group" Battle-tested: Yes — Alex extension scripts
The Problem
Your PowerShell regex replacement isn't working right. You want to capture a group and append "0" to it, but the output is wrong or empty.
Why It Happens
PowerShell (and many regex engines) interpret $1 followed by a digit as a multi-digit backreference. $10 means "capture group 10", not "capture group 1 followed by the character 0".
The Rule
Use `${n}` syntax or named groups when backreference is followed by a digit
Safe Patterns
| Scenario | Pattern | Replacement | |
|---|---|---|---|
| Backreference + digit | (\d+) | ${1}0 | |
| Backreference + letter | (\d+) | $1x (safe, no ambiguity) | |
| Multiple groups | (\d+)\.(\d+) | ${1}_${2} | |
| Named groups | (?<major>\d+) | ${major} |
Real-World Example
Bumping a version number:
Cross-Platform Note
This ambiguity exists in:
- PowerShell (
-replace) - .NET (
Regex.Replace) - JavaScript (
String.replacewith function) - Python (
re.sub)
The ${n} syntax works in PowerShell and .NET. JavaScript and Python have their own escaping rules.
Verification
Source: Promoted from AI-Memory global-knowledge.md (2026-04-27)
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/platform-tooling/powershell-regex-backreference/skills/powershell-regex-backreference/SKILL.md
Popularity
- Repository stars
- 4
- Repository forks
- 1
- 7-day trend score
- 13
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/fabioc-aloha/alex_skill_mall/powershell-regex-backreference)