// Search multiple spaces with regex expressions


/ Published in: PHP

Replaces spaces by '\s+' which means one or more spaces
$string can be one string or one array of strings


Copy this code and paste it in your HTML
  1. function regex_spaces($string)
  2. {
  3. return str_replace(' ','\s+',$string);
  4. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.