{"id":15420257,"url":"https://github.com/jakebailey/secreplace","last_synced_at":"2025-11-12T22:31:04.892Z","repository":{"id":57552437,"uuid":"151892543","full_name":"jakebailey/secreplace","owner":"jakebailey","description":"Go library for replacing sections of strings","archived":false,"fork":false,"pushed_at":"2018-10-07T19:19:36.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T04:23:10.515Z","etag":null,"topics":["go","golang"],"latest_commit_sha":null,"homepage":null,"language":"Go","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/jakebailey.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":null,"support":null}},"created_at":"2018-10-07T00:17:54.000Z","updated_at":"2024-12-28T19:48:13.000Z","dependencies_parsed_at":"2022-09-26T18:50:41.898Z","dependency_job_id":null,"html_url":"https://github.com/jakebailey/secreplace","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jakebailey/secreplace","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakebailey%2Fsecreplace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakebailey%2Fsecreplace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakebailey%2Fsecreplace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakebailey%2Fsecreplace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jakebailey","download_url":"https://codeload.github.com/jakebailey/secreplace/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakebailey%2Fsecreplace/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284122919,"owners_count":26951149,"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","status":"online","status_checked_at":"2025-11-12T02:00:06.336Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["go","golang"],"created_at":"2024-10-01T17:28:47.763Z","updated_at":"2025-11-12T22:31:04.875Z","avatar_url":"https://github.com/jakebailey.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# secreplace\n\n[![GoDoc Reference](https://godoc.org/github.com/jakebailey/secreplace?status.svg)](http://godoc.org/github.com/jakebailey/secreplace) [![Go Report Card](https://goreportcard.com/badge/github.com/jakebailey/secreplace)](https://goreportcard.com/report/github.com/jakebailey/secreplace) [![Build Status](https://travis-ci.com/jakebailey/secreplace.svg?branch=master)](https://travis-ci.com/jakebailey/secreplace) [![Coverage Status](https://coveralls.io/repos/github/jakebailey/secreplace/badge.svg?branch=master)](https://coveralls.io/github/jakebailey/secreplace?branch=master)\n\n\n`secreplace` is a library which aids in the string replacement of \"sections\".\nA section is defined as text enclosed by open and close terminators.\n\nFor example, take the following string:\n\n```\nHi, my name is (_NAME_)!\n```\n\n`(_` and `_)` are the open and close terminators, respectively. We'd like\nto replace `(_NAME_)` with something else. Let's pick a function and run\n`ReplaceOne`:\n\n```go\nreplacer := func(s string) (string, error) {\n    return \"COOL-\"+s, nil\n}\n\nout, changed, err := ReplaceOne(\"Hi, my name is (_NAME_)!\", \"(_\", \"_)\", replacer)\n// out     == \"Hi, my name is COOL-NAME!\"\n// changed == true\n// err     == nil\n```\n\nThe `ReplaceAll` function will repeatedly call `ReplaceOne` until no more\nreplacements can occur. This allows for nesting, for example:\n\n\n```go\nreplacer := func(s string) (string, error) {\n    return \"COOL\"+s, nil\n}\n\nout, changed, err := ReplaceAll(\"Hi, my name is (_(_A_)-(_B_)_)!\", \"(_\", \"_)\", replacer)\n// out     == \"Hi, my name is COOL-COOL-A-COOL-B!\"\n// changed == true\n// err     == nil\n```\n\nAny errors returned by the replacement function will be returned by\n`ReplaceOne` and `ReplaceAll`. Any unmatched terminators will be caught and\nalso cause errors to be returned.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakebailey%2Fsecreplace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjakebailey%2Fsecreplace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakebailey%2Fsecreplace/lists"}