Activity › Forums › Adobe After Effects Expressions › Best way to split words and include spaces Adobe After Effects Expressions Best way to split words and include spaces Posted by Edward Clayton on October 24, 2022 at 4:03 pm What would be the best way to .split() text to include spaces, while excluding line breaks from the result? I’m guessing there’s a way use .split(/\s/) and then add the spaces later, but I’m stumped. Paul Ducco replied 3 years, 6 months ago 3 Members · 3 Replies 3 Replies Filip Vandueren October 24, 2022 at 7:16 pm This is one way, don’t know it it’s the best. t = 'apple banana \rcow dog\relephant';words = t.match(/\S+ */g); Edward Clayton October 24, 2022 at 7:18 pm Exactly what I was looking for. Thank you! Paul Ducco October 24, 2022 at 8:38 pm Filip to the rescue! Reply to this Discussion! Login or Sign Up Public All Members My Connections Only Me PublicAll MembersMy ConnectionsOnly Me Public All Members My Connections Only Me Reply to this Discussion! Login or Sign Up