MATLAB: Replace a single character with a new line in a string

indexingstring

Hello there,
I have a string for example: 'hello there how are you today'
All i want to do is to index a character, remove that indexed character and then create a new line.
If i wanted to index the letter 'w' in 'how' for the example above, then it would perform the following:
'hello ho
are you today'
I know this seems weird, but i am doing something much more complicated so understanding how to do this in an easy way would really help with my undrstanding.
Thank you and would really appreciate some help.
Best wishes

Best Answer

>> str = 'hello there how are you today';
>> regexprep(str,'w','\n')
ans = hello there ho
are you today
And to remove that space character as well:
>> regexprep(str,'w\s*','\n')
ans = hello there ho
are you today