regex for at least 2 empty space?

regex, ruby

Solution

Whitespace matching is `\s` and you can supply a minimum and maximum in curly braces. You can also omit either of them, like so:

\s{2,}

So your code would be like:

"MARY   HAD A LITTLE            LAMB".split(/\s{2,}/)

You can test it online here!

Problem

i need to ignore anything that is one space, and empty space at least bigger than one space should be matched... ``` "MARY HAD A LITTLE LAMB" ``` i expect ``` "MARY", "HAD A LITTLE", "LAMB" ```

Original source