-2

Can you please suggest a regex code that will select all words. Basically everything between whitespaces

Example-string('This is a man's world') I need to match-'This' 'is' 'a' 'man\s' 'world'

Andrej Kesely
  • 118,151
  • 13
  • 38
  • 75
  • Why does the apostrophe get replaced by a backslash in the output? Did you mean to escape it? Do you expect the regex to do that too? Basically, you want: `\w+` – Gary Dec 15 '19 at 13:22
  • `\S+` will match all non-whitespace characters – Andrej Kesely Dec 15 '19 at 13:23

1 Answers1

0

This one should do:

(\S+)

It will match all sequences of non-space characters.

See https://regex101.com/r/LZ6C1s/2 for explanation

Ward
  • 2,731
  • 18
  • 26