5 ms·
What does this notation mean: "s/descriptive/proscriptive/g" ?
by ed312 6y ago
What does this notation mean: "s/descriptive/proscriptive/g" ?
- cochne 6y agoThis means find and replace descriptive with proscriptive. It is a pattern used by Vim and Sed, and probably some other programs.
- virgil_disgr4ce 6y agoIt's regex, vim and sed just happen to use it
- Jtsummers 6y agoSubstitute <pattern> with <replacement> globally. https://www.gnu.org/software/sed/manual/html_node/The-_0022s_0022-Command.html https://www.gnu.org/software/sed/manual/html_node/The-_0022s...
- adwn 6y agoReplace all occurrences of 'descriptive' with 'proscriptive'
- pdkl95 6y agoIt's originally from sed's "s"ubstitute command[1], and later incorporated into many other tools. The "s" at the front is the command name, which is followed by two sections delimited by "/"; these are regex pattern that is matched on the input, and the replacement string. The final "g" is an optional "global" flag that requests that all matches inthe input should be substituted, instead of only the first. s/ ...matching regex... / ...replacement string... /g The use in the parent post therefor means: "Replace every 'descriptive' in the text with the string 'proscriptive'." [1] https://www.gnu.org/software/sed/manual/html_node/The-_0022s_0022-Command.html https://www.gnu.org/software/sed/manual/html_node/The-_0022s...