Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please explain replace(/^\s*/, '') and replace(/\s*$/, '')

Status
Not open for further replies.

taubate

Programmer
Jun 29, 2001
141
US
I know these functions are used to remove leading and trailing white space. But what is /^\s*/ and /\s*$/ ?

Thanks.
 
\s is all white spaces.
^ is beginning of the string and
$ the end of the string.

So the first expression is, Begin with all spaces and then any character (* - wild card) and the second is spaces at the end.

Like google, please try "alltooflat.com".

End
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top