{"action":"created","issue":{"url":"https://api.github.com/repos/fish-shell/fish-shell/issues/4853","repository_url":"https://api.github.com/repos/fish-shell/fish-shell","labels_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/4853/labels{/name}","comments_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/4853/comments","events_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/4853/events","html_url":"https://github.com/fish-shell/fish-shell/pull/4853","id":308360895,"number":4853,"title":"Fix minor shell-scripting issues.","user":{"login":"drwilly","id":826152,"avatar_url":"https://avatars1.githubusercontent.com/u/826152?v=4","gravatar_id":"","url":"https://api.github.com/users/drwilly","html_url":"https://github.com/drwilly","followers_url":"https://api.github.com/users/drwilly/followers","following_url":"https://api.github.com/users/drwilly/following{/other_user}","gists_url":"https://api.github.com/users/drwilly/gists{/gist_id}","starred_url":"https://api.github.com/users/drwilly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drwilly/subscriptions","organizations_url":"https://api.github.com/users/drwilly/orgs","repos_url":"https://api.github.com/users/drwilly/repos","events_url":"https://api.github.com/users/drwilly/events{/privacy}","received_events_url":"https://api.github.com/users/drwilly/received_events","type":"User","site_admin":false},"labels":[{"id":4724778,"url":"https://api.github.com/repos/fish-shell/fish-shell/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-03-25T15:54:35Z","updated_at":"2018-03-26T15:04:48Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/fish-shell/fish-shell/pulls/4853","html_url":"https://github.com/fish-shell/fish-shell/pull/4853","diff_url":"https://github.com/fish-shell/fish-shell/pull/4853.diff","patch_url":"https://github.com/fish-shell/fish-shell/pull/4853.patch"},"body":"fixes to some of my personal pet-peeve shell-scripting issues."},"comment":{"url":"https://api.github.com/repos/fish-shell/fish-shell/issues/comments/376198622","html_url":"https://github.com/fish-shell/fish-shell/pull/4853#issuecomment-376198622","issue_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/4853","id":376198622,"user":{"login":"faho","id":5185367,"avatar_url":"https://avatars3.githubusercontent.com/u/5185367?v=4","gravatar_id":"","url":"https://api.github.com/users/faho","html_url":"https://github.com/faho","followers_url":"https://api.github.com/users/faho/followers","following_url":"https://api.github.com/users/faho/following{/other_user}","gists_url":"https://api.github.com/users/faho/gists{/gist_id}","starred_url":"https://api.github.com/users/faho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/faho/subscriptions","organizations_url":"https://api.github.com/users/faho/orgs","repos_url":"https://api.github.com/users/faho/repos","events_url":"https://api.github.com/users/faho/events{/privacy}","received_events_url":"https://api.github.com/users/faho/received_events","type":"User","site_admin":false},"created_at":"2018-03-26T15:04:48Z","updated_at":"2018-03-26T15:04:48Z","author_association":"MEMBER","body":">Does string replace support capture-groups?\r\n\r\nSure it does. The regex-mode is based on pcre2, so it's quite full-featured. As a rule of thumb, characters are usually \"magic\", so capturing groups are just `(expression)`, and non-capturing groups are `(?:expression)`. See the [pcre2 syntax specification](http://pcre.org/current/doc/html/pcre2syntax.html) (we might want to add some of that to string's help page).\r\n\r\nAs a contrived example:\r\n\r\n```fish\r\nstring replace -r '(.*)=(.*)' '$1\\t$2'\r\n```\r\n\r\nThere's also the \"--filter\"/\"-f\" option to remove all lines/arguments where no substitution occurs, and the \"-a\"/\"--all\" option which is like sed's \"/g\".\r\n\r\n>and no, 2 calls to replace are no adequate substitution.\r\n\r\nThey quite often are! They don't have the overhead of `fork()`ing, so spinning up another is rather cheap.\r\n\r\nI guess it's also a bit of a stylistic question, but I often find `sed` (and e.g. `awk`) to be a bit dense, and that by using a couple of statements/lines with `string` et al you can make it more readable.\r\n\r\n>So it really doesn't take much looking to find a frequently used use-case where a pure fish implementation would require quite a bit of boilerplate code.\r\n\r\nI'm not saying that there never is a use-case for non-builtins, but most of what we do is simple match-and-substitute, and for that `string` is usually perfectly capable. And if it isn't, there's the option of enhancing it.\r\n\r\n(Also note that the maven example actually parses xml with regex, which is strictly speaking impossible)"}}
{"actor":{"display_login":"faho"}}