regex - How to put a space between hyphen and next character unless it's a multi-word?
问题描述
I have a text that contains both multi-words
and dialog-like phrases like -hello
and I want to separate hyphen from the word only if it's not part of the multi-word, meaning hyphen is not surrounded by two chars.
The word could appear anywhere in the sentence, not just the beginning. Example:
input:
multi-media
-hello -oh, hi
desired output:
multi-media
- hello - oh, hi
Can this be accomplished using sed
or awk
?
解决方案
推荐阅读
- angular - 当我使用 Drilldown(Highcharts) 时,我的构建 --prod 在角度 8 中变得非常大
- google-cloud-platform - 如何在 google 计算引擎和 google bigquery 之间创建专用网络?
- c - 为什么要在这个 flex 程序上过早地使用 eof?
- android - RecyclerView 中的线圈不会在滚动时加载新内容
- javascript - 我们如何在需要时保证 Javascript 中的同步行为?
- android - 需要在 Android Studio 上清除最近的路径
- python - Django 解析 json(来自 Webhooks)
- javascript - 没有输入文本或下拉选择时禁用提交
- filter - Logstash Http 输出过滤器
- sparql - 是否有一个 SPARQL 查询来将一个工作流的不同流程步骤跟踪到一行中