By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,516 Members | 1,194 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,516 IT Pros & Developers. It's quick & easy.

Need help with RegEx

P: n/a
Hello. I am looking for a Javascript regular expression that will
filter out all multiple spaces. I know it's something with /s but
what?

Thanks, Dante.
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Dante wrote on 11 feb 2004 in comp.lang.javascript:
Hello. I am looking for a Javascript regular expression that will
filter out all multiple spaces. I know it's something with /s but
what?


t = t.replace(/\s{2,}/g,"")

Or if you want to replace tham with a single space:

t = t.replace(/\s{2,}/g," ")
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.