How can I Remove everything behind the "-" with regex in Atom.
如何在Atom中使用正则表达式删除“ - ”后面的所有内容。
I have a list with
我有一个清单
- Alex Tweewielers - 's Gravenzande
- Alex Tweewielers - 的Gravenzande
- Nijland Tweewielers BV - 's Heerenberg
- Nijland Tweewielers BV - 的Heerenberg
- Tweewielercentrum - 's-Gravendeel
- Tweewielercentrum - 's-Gravendeel
- Leo Joosse Tweewielers BV - Aagtekerke
- Leo Joosse Tweewielers BV - Aagtekerke
Result should be
结果应该是
- Alex Tweewielers
- Alex Tweewielers
- Nijland Tweewielers BV
- Nijland Tweewielers BV
- Tweewielercentrum
- Tweewielercentrum
- Leo Joosse Tweewielers BV
- Leo Joosse Tweewielers BV
1 个解决方案
#1
1
Find:
找:
^(.*?)\s-.*$
Replace:
更换:
$1
In the event that you have more than one dash (preceded by a whitespace) in a given line, this solution would discard everything after the first dash.
如果您在给定行中有多个短划线(前面有空格),此解决方案将丢弃第一个短划线后的所有内容。
#1
1
Find:
找:
^(.*?)\s-.*$
Replace:
更换:
$1
In the event that you have more than one dash (preceded by a whitespace) in a given line, this solution would discard everything after the first dash.
如果您在给定行中有多个短划线(前面有空格),此解决方案将丢弃第一个短划线后的所有内容。