{"id":13447186,"url":"https://github.com/sindresorhus/escape-string-regexp","last_synced_at":"2025-05-13T17:11:19.967Z","repository":{"id":399785,"uuid":"21169121","full_name":"sindresorhus/escape-string-regexp","owner":"sindresorhus","description":"Escape RegExp special characters","archived":false,"fork":false,"pushed_at":"2025-05-06T15:42:08.000Z","size":24,"stargazers_count":593,"open_issues_count":0,"forks_count":54,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-05-10T23:11:23.446Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sindresorhus.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/security.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","buy_me_a_coffee":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2014-06-24T15:04:40.000Z","updated_at":"2025-05-08T02:02:25.000Z","dependencies_parsed_at":"2024-11-05T18:44:45.579Z","dependency_job_id":null,"html_url":"https://github.com/sindresorhus/escape-string-regexp","commit_stats":{"total_commits":32,"total_committers":8,"mean_commits":4.0,"dds":0.46875,"last_synced_commit":"6ced614edea7cabc72a8973108659b3cdb75e30e"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fescape-string-regexp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fescape-string-regexp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fescape-string-regexp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fescape-string-regexp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/escape-string-regexp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253618907,"owners_count":21937069,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T05:01:10.401Z","updated_at":"2025-05-13T17:11:14.952Z","avatar_url":"https://github.com/sindresorhus.png","language":"JavaScript","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://buymeacoffee.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["Packages","JavaScript","Repository","包","目录","others","Text"],"sub_categories":["Text","RegExp/Glob","文本","文本处理"],"readme":"# escape-string-regexp\n\n\u003e Escape RegExp special characters\n\n## Install\n\n```sh\nnpm install escape-string-regexp\n```\n\n## Usage\n\n```js\nimport escapeStringRegexp from 'escape-string-regexp';\n\nconst escapedString = escapeStringRegexp('How much $ for a 🦄?');\n//=\u003e 'How much \\\\$ for a 🦄\\\\?'\n\nnew RegExp(escapedString);\n```\n\nYou can also use this to escape a string that is inserted into the middle of a regex, for example, into a character class.\n\nOnly the minimal amount of escaping is done, and developers are expected to insert escaped strings at safe positions in a `RegExp`. This keeps the output simple and gives you the best results in most cases. For edge case placements of escaped strings (such as immediately following `\\0` or `\\c`), the escaped value can change the meaning of the preceding or following token. If fully context-aware escaping is needed, consider interpolating a string using the [`regex`](https://github.com/slevithan/regex#interpolating-escaped-strings) package.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fescape-string-regexp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Fescape-string-regexp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fescape-string-regexp/lists"}