So far I've only been able to find partial solutions that produce a different problem. I'd really appreciate any help.
I started a would you rather site with my friends. They had dozens of questions written in word that they have copied and pasted into a database. Each question has four parts (two for each choice). The about and the rules and restrictions.
The trouble is that within each part, the information looks like this example from one of the rules and restrictions (I know it's dumb, please ignore the content. I chose this one because it has all the troublesome elements):
The spaces between the period and hyphen are line breaks (actually spaces here because it was recognizing the line breaks, but you get the idea).-Elbow sucking must be consensual. In other words, the suckee must not oppose. -The elbow sucking does not count if you tell the person that you will die or will be harmed if they do not agree. -You cannot pay off someone to suck their elbow. -You can never re-suck the same person again.
I would like it to look like this:
I tried a str_replace for the hyphens, but then it changes the hyphen in re-suck, which I don't want. I also can't str_replace the hyphen with a space after it because re-suck is a problem again. I can't put breaks only after the period because sometimes there are multiple sentences within each thing.• Elbow sucking must be consensual. In other words, the suckee must not oppose.
• The elbow sucking does not count if you tell the person that you will die or will be harmed if they do not agree.
• You cannot pay off someone to suck their elbow.
• You can never re-suck the same person again.
So far the best solution I've found is nl2br(), but that's still not great. I suppose the ideal situation would be to create list items.
I'm thinking if we could replace the hyphens that aren't between two characters with a "</li><li>" it might work. Obviously, I'd put an <li> and </li> around the string. It'd have to not run on the first instance, but still remove the hyphen, however, so that's a lot of exceptions. I assume it's doable, but I have no idea how.