i want to store each word in string using \s and \S regex not by using any split or while loop.

So, first you had said you looking for a solution WITHOUT while-loop. Now you say, you are looking for a solution WITH while-loop. How about making up your mind what kind of solution you are looking for?

in my example a string can have any word so how we are going to group your example was having like xxabayyyybcbbbzz and we want abc to be grouped but in my case i dont know what type of word is goin 2 come only spaces is the only parameter 2 define it .

n my case i dont know what type of word is goin 2 come only spaces is the only parameter 2 define it

Sorry, I fail to understand this sentence. Maybe you can rephrase it?

Also, you need to define first what is a "word". Is it a set of lower and upper case letters? What about accented letters or letters in Japanese Alphabet? Is it maybe a set of everything but space? Is it a set of everything but white space?