BandonRandon Posted March 13, 2011 Share Posted March 13, 2011 Hello, I'm trying to create a simple content formater. I would like to be able to paste content from and e-mail and have it format it in an easy printer friendly way. Right now I have the following php code: $text= $_POST['textinput']; $paragraphs= $_POST['keep_paragraphs']; $shift_left= $_POST['shift_left']; if(get_magic_quotes_gpc()){ $text = stripslashes($text); // strip off the slashes if they are magically added. } $text = htmlentities($text); //if we should keep formatting if($paragraphs=="true"){ $text =nl2br($text); } //if we want to shift all text left if no break is inbetween if($shift_left=="true"){ $text = preg_replace('/(?<!\r\n)\r\n(?=\w)/', ' ', trim($text)); } echo ($text); The part that isn't working is the preg_replace. I am trying to make it so This Is The First Paragraph Second Paragraph Becomes This Is The First Paragraph Second Paragraph Any Ideas would be great. Quote Link to comment https://forums.phpfreaks.com/topic/230498-move-content-left-remove-space-on-right/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.