Created
September 11, 2012 23:26
-
-
Save plasticbrain/3702974 to your computer and use it in GitHub Desktop.
PHP: (REGEX/preg_replace) replace multiple characters (ie: spaces)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//-------------------------------------------------------------------------- | |
// Replace multiple spaces with a single space | |
// Substitute "\s\s" with whatever characters you want to check for | |
//-------------------------------------------------------------------------- | |
$text = preg_replace("/\s\s+/", ' ', $text); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment