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

  • 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 Jun 19 '19 at 19:06
  • "\s-" this also work – a_subscriber Jun 20 '19 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 Jun 23 '19 at 2:42
4

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

"[[:space:]]"
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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