Hi all.. .I'm trying to use preg_split but I'm having trouble getting the regular expression I want.
What I have now is a long character string, upwards of 200 characters depending on user input. I'm trying to do is break up my string an array, each element in that array having 50 characters. But I dont want to use str_split because that has the possibility to break up the string in the middle of words. So I'd like to create a regular expression that will get at max 50 characters and end in a space and use the functionality of preg_split to accomplish this.
What my pattern looks like is this (and mind you I'm not all that good with regex...)
Like I said, should be any string 1-50 characters long with a space proceeding the last character.
Any help would be much appreciated.