Jump to content

[SOLVED] convert all \n and \t to spaces, and replace 2 spaces with 1


scarhand

Recommended Posts

I need a regex that will preg_replace all "\n" (linebreaks) and "\t" (tabs) to spaces. After this is done, I want it to convert 2 spaces "  " into 1 space " ".

 

I know how to preg_replace the "\n" and "\t", but not the 2 spaces into 1. I imagine it would have something to do with {2} or something like that.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.