Selectively replace multiple instances of a character within a string: Difference between revisions
Selectively replace multiple instances of a character within a string (view source)
Revision as of 08:07, 4 July 2024
, 3 days agoAdd ed example
(Added Easylang) |
(Add ed example) |
||
Line 344:
AErBcadCbFD
</pre>
=={{header|ed}}==
Port of [[#sed]] solution.
<syntaxhighlight lang="sed">
# by Artyom Bologov
H
s/a\([^a]*\)a\([^a]*a[^a]*\)a\([^a]*\)a/A\1B\2C\3D/
s/b/E/
s/\(r[^r]*\)r/\1F/
,p
Q
</syntaxhighlight>
{{out}}
<pre>$ ed -s selective-replace.input < selective-replace.ed
Newline appended
AErBcadCbFD</pre>
=={{header|EMal}}==
|