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"
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"
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,}/)
sed 's/ */ /g'
replaces one or more space..
so i guess regex is,
<space><space>*