Strip comments from a string: Difference between revisions
Add ed example
(PascalABC.NET) |
(Add ed example) |
||
Line 806:
print strip "No comment " & "."
</syntaxhighlight>
=={{header|ed}}==
<syntaxhighlight lang="sed">
H
,p
g/.*/s/[[:space:]]*([;#](.*))?$//
,p
Q
</syntaxhighlight>
{{out}}
<pre>$ cat strip-comments.ed | ed -lEGs strip-comments.input
apples, pears # and bananas
apples, pears ; and bananas
qwerty # asdfg ; zxcvb
;this is a comment
#this is a comment
apples, pears
apples, pears
qwerty
</pre>
=={{header|Erlang}}==
|