【发布时间】:2013-04-12 16:37:40
【问题描述】:
我在 c# 中有一个很大的文本列表,想要用作枚举列表。 例如:
Zone Status Message
Zones Snapshot Message
Partition Status Message
Partitions Snapshot Message
Supported transition message flags
System Status Message
X-10 Message Received
Log Event Message
Keypad Message Received
现在我想使用 Visual Studio 中的查找和替换对话框在所有单词中添加下划线而不是空格, 例如
Zone_Status_Message
Zones_Snapshot_Message
如何使用正则表达式或通配符来实现这一点? 这真的会为我节省很多时间。
提前致谢。
编辑:
由于我从中获取文本的源文档格式不正确,这些单词也可以有空格和前后。所以下划线只能在2个单词之间加空格。
【问题讨论】:
标签: regex visual-studio-2010 replace