Jump to content

Split a character string based on change of character: Difference between revisions

Add 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}}==
90

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.