小编Spa*_*ker的帖子

如何组合正则表达式的 POSIX 字符类?

我需要在 sed 使用的正则表达式中组合不同的字符类。我需要匹配[:word:]和 减号-。看起来怎么样?我所有的尝试都未能尝试或寻找解决方案。

在以下字符串中,我想匹配所有内容,直到第一个空格:

foo-bar     |
baz-xyz-123 |
Run Code Online (Sandbox Code Playgroud)

sed posix regular-expression

6
推荐指数
1
解决办法
3851
查看次数

标签 统计

posix ×1

regular-expression ×1

sed ×1