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

lawlz!

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

That sounds about right! Funnily enough i wandered what the letter L in the middle was - doe! :blush:


  1. /b ↩︎

Matches something that
[b][1] 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.


  1. /b ↩︎