How can ı delete space between words in text file? How can create a list and insert the elements into it?

I want to select the words in a text file and print them to the excel file according to their meaning. There are spaces between the words. I don’t know how to delete the spaces.
I’m having trouble using commands like toString,toArray,Append.
I would appreciate it if you could suggest solutions and resources for me to learn them.
For example text files:
“red john
465464 54654 (blue)
(0range) 58ran8e9q”
ı would like this


Welcome to the community

Assumes your string is present in variable str

For getting array of numbers and words use this

Numarr = System.Text.RegularExpressions.Regex.Matches(str,"\d+").Select(function(x) x.Value).ToArray()

wordsarr = System.Text.RegularExpressions.Regex.Matches(str,"[A-Za-z]*").Select(function(x) x.Value).ToArray()

Now in the second word array you would have colors as well…

You have to separate them by having a array of possible colors already with you…because columns cant be separately identified unless we have a list or any pattern

Arrtotalcolor = {"Yellow","Red",…..}

This will select the colors into a aeparate array by matching with arrtotalcolor values

ColorArr = ArrTotalColor.Intersect(wordsarr)

This will remove the colors from the wordsarr and retain remaining values

Wordsarr = wordsarr.Except(ColorArr)

Hope this helps