Split a character string based on change of character: Difference between revisions
Split a character string based on change of character (view source)
Revision as of 19:07, 1 July 2024
, 2 days agoAdd ed example
(Add Uiua) |
(Add ed example) |
||
Line 1,199:
g, HHH, 5, YY, ++, ///, \
</pre>
=={{header|ed}}==
<syntaxhighlight lang="sed">
# by Artyom Bologov
H
# Repeating two times because matching is greedy
g/.*/s/((.)\2*)((.)\4*)/\1\
\3/g
g/.*/s/((.)\2*)((.)\4*)/\1\
\3/g
,p
Q
</syntaxhighlight>
{{out}}
<pre>$ cat split-on-change.ed | ed -lEGs split-on-change.input
Newline appended
g
HHH
5
YY
++
///
\
</pre>
=={{header|Elixir}}==
|