René's URL Explorer Experiment


Title: `$1`, `$&` in string replacements for RegExp `find` are not expanded · Issue #117 · unplugin/unplugin-replace · GitHub

Open Graph Title: `$1`, `$&` in string replacements for RegExp `find` are not expanded · Issue #117 · unplugin/unplugin-replace

X Title: `$1`, `$&` in string replacements for RegExp `find` are not expanded · Issue #117 · unplugin/unplugin-replace

Description: Describe the bug The README for options.values states: "If it's a string, it will replace the substring matched by pattern. A number of special replacement patterns are supported". However, transform passes string replacements through St...

Open Graph Description: Describe the bug The README for options.values states: "If it's a string, it will replace the substring matched by pattern. A number of special replacement patterns are supported". However, transfo...

X Description: Describe the bug The README for options.values states: "If it's a string, it will replace the substring matched by pattern. A number of special replacement patterns are supported". Ho...

Opengraph URL: https://github.com/unplugin/unplugin-replace/issues/117

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`$1`, `$&` in string replacements for RegExp `find` are not expanded","articleBody":"### Describe the bug\n\nThe README for `options.values` states: \"If it's a string, it will replace the substring matched by pattern. A number of special replacement patterns are supported\". However, `transform` passes string replacements through `String(ensureFunction(finalReplacement)(id, match))`, which returns the string verbatim without expanding `$1`, `$&`, `$\u003cname>`, or `$$`.\n\n```js\n// repro.mjs\nimport Replace from 'unplugin-replace/rollup'\n\nconst plugin = Replace({\n  values: [{ find: /process\\.env\\.(\\w+)/g, replacement: 'import.meta.env.$1' }],\n})\n\nconst res = await plugin.transform.handler.call(\n  {},\n  'f(process.env.API_URL)',\n  '/src/a.js',\n)\nconsole.log(res.code)\n```\n\nRunning `node repro.mjs`:\n\nActual output:\n\n```js\nf(import.meta.env.$1)\n```\n\nExpected output (as with `String.prototype.replace`):\n\n```js\nf(import.meta.env.API_URL)\n```\n\n### Reproduction\n\nhttps://gist.github.com/trackoor/f81e40bdea191f6e323b0e544f0f2cc3\n\n### System Info\n\n```Shell\nSystem:\n  OS: Linux 6.1 Debian GNU/Linux 12 (bookworm) 12 (bookworm)\n  CPU: (64) x64 Intel(R) Xeon(R) CPU @ 2.80GHz\n  Shell: 5.2.15 - /bin/bash\nBinaries:\n  Node: 26.13.0\n  npm: 11.20.0\nnpmPackages:\n  unplugin-replace: 0.9.1 (also tested on main 8d4c2e2)\n```\n\n### Used Package Manager\n\nnpm\n\n### Validations\n\n- [x] Follow our [Code of Conduct](https://github.com/antfu/.github/blob/main/CODE_OF_CONDUCT.md)\n- [x] Read the [Contributing Guide](https://github.com/antfu/contribute).\n- [x] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.\n- [x] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.\n- [x] The provided reproduction is a [minimal reproducible](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.\n\nCredit: https://ucsbplse.github.io/\n","author":{"url":"https://github.com/trackoor","@type":"Person","name":"trackoor"},"datePublished":"2026-11-15T06:07:51Z","url":"https://github.com/unplugin/unplugin-replace/issues/117"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:7236c63c-782f-38e9-5f1f-2c7efa4c3a5e
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDE9E:F5AA9:2AF2AA3:3AA65DE:6B00546A
html-safe-nonce7dbdf80438cd161dc60c295031190dc692b841259ae87ffca7288f9b61fa2f13
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERTlFOkY1QUE5OjJBRjJBQTM6M0FBNjVERTo2QjAwNTQ2QSIsInZpc2l0b3JfaWQiOiIzMDAwNzgxMDUzNjI0NTM2MTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac1d653a3d177f8534b2c11bc122bb741d94ce12bfc0e983ea0aa79edfc4d211a7
hovercard-subject-tagissue:6400707043
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/unplugin/unplugin-replace/117/issue_layout
twitter:imagehttps://opengraph.githubassets.com/c522e49eddc975f9499fb593314c3354ed10215d7d73f7934577cd6957df2d4e/unplugin/unplugin-replace/issues/117
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/c522e49eddc975f9499fb593314c3354ed10215d7d73f7934577cd6957df2d4e/unplugin/unplugin-replace/issues/117
og:image:altDescribe the bug The README for options.values states: "If it's a string, it will replace the substring matched by pattern. A number of special replacement patterns are supported". However, transfo...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernametrackoor
hostnamegithub.com
expected-hostnamegithub.com
Nonef420f4996e6b1ff1ccd6d7683f8134f4b5f0f8a50124c210dbfe7490e5644abb
turbo-cache-controlno-preview
go-importgithub.com/unplugin/unplugin-replace git https://github.com/unplugin/unplugin-replace.git
octolytics-dimension-user_id143585159
octolytics-dimension-user_loginunplugin
octolytics-dimension-repository_id766209113
octolytics-dimension-repository_nwounplugin/unplugin-replace
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id766209113
octolytics-dimension-repository_network_root_nwounplugin/unplugin-replace
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release26e00df917aba0f128135dc073ea0c5e33a70d40
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/unplugin/unplugin-replace/issues/117#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Funplugin%2Funplugin-replace%2Fissues%2F117
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Funplugin%2Funplugin-replace%2Fissues%2F117
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=unplugin%2Funplugin-replace
Reloadhttps://github.com/unplugin/unplugin-replace/issues/117
Reloadhttps://github.com/unplugin/unplugin-replace/issues/117
Reloadhttps://github.com/unplugin/unplugin-replace/issues/117
unpluginhttps://github.com/unplugin
unplugin-replacehttps://github.com/unplugin/unplugin-replace
Codehttps://github.com/unplugin/unplugin-replace
Issues2 (2)https://github.com/unplugin/unplugin-replace/issues
Pull requests1 (1)https://github.com/unplugin/unplugin-replace/pulls
Actionshttps://github.com/unplugin/unplugin-replace/actions
Projectshttps://github.com/unplugin/unplugin-replace/projects
Security and qualityhttps://github.com/unplugin/unplugin-replace/security
Insightshttps://github.com/unplugin/unplugin-replace/insights
https://github.com/unplugin/unplugin-replace
New issuehttps://github.com/login?return_to=https://github.com/unplugin/unplugin-replace/issues/117
New issuehttps://github.com/login?return_to=https://github.com/unplugin/unplugin-replace/issues/117
$1, $& in string replacements for RegExp find are not expandedhttps://github.com/unplugin/unplugin-replace/issues/117#top
https://github.com/trackoor
trackoorhttps://github.com/trackoor
on Nov 15, 2026https://github.com/unplugin/unplugin-replace/issues/117#issue-6400707043
https://gist.github.com/trackoor/f81e40bdea191f6e323b0e544f0f2cc3https://gist.github.com/trackoor/f81e40bdea191f6e323b0e544f0f2cc3
Code of Conducthttps://github.com/antfu/.github/blob/main/CODE_OF_CONDUCT.md
Contributing Guidehttps://github.com/antfu/contribute
minimal reproduciblehttps://stackoverflow.com/help/minimal-reproducible-example
https://ucsbplse.github.io/https://ucsbplse.github.io/
Sign up for freehttps://github.com/signup?return_to=https://github.com/unplugin/unplugin-replace/issues/117
Sign in to commenthttps://github.com/login?return_to=https://github.com/unplugin/unplugin-replace/issues/117
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.