www.webdeveloper.com
Results 1 to 3 of 3

Thread: Removing white space in the middle of a string

  1. #1
    Join Date
    Dec 2005
    Posts
    203

    Removing white space in the middle of a string

    Hey, I found this snippet on in the manual. Could someone please explain how it works (specifically the ' +')

    $string = ereg_replace (' +', ' ', $string);

    Thanks!

  2. #2
    Join Date
    Dec 2005
    Posts
    203
    I get it now:

    '_+' = one or more
    '__+' = two or more
    '___+' = three or more

    and so on.

  3. #3
    Join Date
    Sep 2006
    Location
    Bucharest, RO
    Posts
    940
    Quote Originally Posted by http://php.net/ereg-replace
    Tip
    preg_replace(), which uses a Perl-compatible regular expression syntax, is often a faster alternative to ereg_replace().
    If you haven't yet learned about regular expressions, I'd recommend you learn about Perl-compatible ones. Here's a good tutorial on them: http://tote-taste.de/X-Project/regex/index.php
    Good luck

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles