I am an editor faced with editing text in which the style requirements say there should be TWO blank spaces between sentences. So I was going to write a straightforward PHP routine with an HTML form to check for one-space separations so that I could mark and correct them. Unfortunately, I discovered that the form submission process automatically changes double spaces to single spaces, so it's impossible for me to separate the "real" single spaces in the text from the ones that the PHP submission process created.

I'm trying to figure out how I can submit cut-and-paste text through a form such that the extra spaces in the text are retained (after I "ingest" the text into my PHP code using $_REQUEST). Or is there a way for me to submit text without a form using PHP. I was trying to avoid getting a d/b involved, but I could use my mysql databases for this if it would help.

Thanks in advance for any ideas. I've looked online but almost everyone is talking about getting RID of double spaces, not retaining them.


Would you be able to incorporate something like this into your PHP file

<?php if (preg_match('/^. [A-Z]$/' || '/^.  [A-Z]$/')) { preg_replace('. ', '.&nbsp; '); } ?>

so that when you parse or test the input (file) it would search for .spacespaceA-Z, or .spaceA-Z and then replace that with .&nbsp;space?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.