I have a string like this:
text..moretext,moartxt..,asd,,gerr..,gf,erg;ds
Which is basically, variable amounts of text, followed by variable amounts of punctuation, followed by further variable amounts of text and so forth.
How can I convert the above string to this in PHP using Regex?
text. .moretext, moartxt. . ,asd, ,gerr. . ,gf, erg; ds
Each word may only have 1 character of punctuation on either side of it.
moretext, moartxt) and sometimes you don't (e.g.,. ,asd,). If you're consistent, or it doesn't matter, then the answer is very easy.