Jump to content

Finding a a carriage return in user entered text


Cojawfee

Recommended Posts

I'm currently in the process of refining a comment system I wrote, and I am including autoformatting and a BBcode like system.

The only problem I am having is with preserving user created carriage returns. If you look at the source for this page and search for "The only problem" you will see that there are two "<br />" tags bewteen it and the previous paragraph. I was thinking about using str_replace() for this, but can you use the escape character for a carriage return to search for a carriage return that doesn't use the escape?

If you are confused by the previous sentence, let me clear it up. When someone press enter twice (to create a new paragraph) I want to replace that with two "<br>" tags when it is displayed.

There is obviously a way to do this, I would just like to know how.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.