0

I want to select by regexp only spaces.

Here text:

test-hello how-are again ok
maybe good but-some not good

I use regexp

[:space:]

but it's not work:

enter image description here

3
  • Please say what command(s) you use. And please clarify whether you want to find all stretches of whitespace, of any kind, or just space characters. [[:space:]] matches whitespace characters of all kinds, and those depend on the current syntax table.
    – Drew
    Commented Jun 19, 2019 at 19:06
  • "\s-" this also work Commented Jun 20, 2019 at 7:15
  • 1
    The regexp you used, [:space:] matches the colon, :, and any letter in the word "space" (so it is equivalent to, say, [aceps:]). To match a space you could use [[:space:]].
    – Omar
    Commented Jun 23, 2019 at 2:42

1 Answer 1

4

You need to enclose your :space: class in []:

"[[:space:]]"
1
  • "\s-" this also work Commented Jun 20, 2019 at 7:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.