我知道以前有人问过这个问题,但这只是有点不同:我需要删除所有评论,不包括转义#
或其他不意味着开始评论(在单顶点或双顶点之间)
从以下文本开始:
test
# comment
comment on midline # comment
escaped hash "\# this is an escaped hash"
escaped hash "\\# this is not a comment"
not a comment "# this is not a comment - double apices"
not a comment '# this is not a comment - single apices'
this is a comment \\# this is a comment
this is not a comment \# this is not a comment
Run Code Online (Sandbox Code Playgroud)
我想获得
test
comment on midline
escaped hash "\# …
Run Code Online (Sandbox Code Playgroud)