Ignore punctuation and assume sentence will not be empty

I’ve gotten this far but when i use regex it still takes the word as the longest after i removed the thing asked in test.

I don’t understand what you mean here. The code you posted isn’t using any regex. Your code also doesn’t ignore punctuation. You are simply splitting the input on spaces, so "hello.,!?;" would be a word with a length of 10 rather than simply "hello" with a length of 5.