Posted By

jatubio on 02/21/15


regex pregmatch

Versions (?)

// 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

  1. function regex_spaces($string)
  2. {
  3. return str_replace(' ','\s+',$string);
  4. }

Report this snippet  

You need to login to post a comment.