SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard boxhead's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    1,040
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    what does this regexp match?

    Can someone please let me know what this matches - i can work out some but not all:

    /^\s+|\s+$/

    cheers
    monkey - the rest is history

  2. #2
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,279
    Mentioned
    51 Post(s)
    Tagged
    2 Thread(s)
    Matches something that
    ^ begins with
    + one or more
    \s whitespace characters
    | OR
    $ ends with
    + one or more
    \s whitespace characters

    I believe. I might not be entirely correct. To test, make a string with no whitespace chars at beginning or end, make one with whitespace only at the beginning, make one with whitespace only at the end, and make one with whitespace on both ends.

    If I'm right, all but the first will match.

  3. #3
    SitePoint Wizard boxhead's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    1,040
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Stomme poes View Post
    Matches something that
    ^ begins with
    + one or more
    \s whitespace characters
    | OR
    $ ends with
    + one or more
    \s whitespace characters

    I believe. I might not be entirely correct. To test, make a string with no whitespace chars at beginning or end, make one with whitespace only at the beginning, make one with whitespace only at the end, and make one with whitespace on both ends.

    If I'm right, all but the first will match.
    That sounds about right! Funnily enough i wandered what the letter L in the middle was - doe!
    monkey - the rest is history

  4. #4
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,279
    Mentioned
    51 Post(s)
    Tagged
    2 Thread(s)
    lawlz!

    Maybe check all your code in a serif font first?? : )


Bookmarks

Posting Permissions

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