Double strip of spaces in string (ruby)

I have this string:

"item one :value1 , item2: value2,item3 : value3"

how can i obtain this one?:

"item one:value1,item2:value2,item3:value3"

(i need to strip spaces between ","-separated items , and between ":"-separated items)

Answers


irb(main):008:0> "item one :value1 , item2: value2,item3 : value3".gsub(/\s*([,:])\s*/,'\1')
=> "item one:value1,item2:value2,item3:value3"

Need Your Help

CakePHP Issue: Unexpected call to database

php mysql cakephp

A question for the CakePHP community:

Trying to build a Drupal-like CMS in ASP.NET MVC - Newbie Questions

asp.net asp.net-mvc drupal content-management-system customization

I am new to ASP.NET MVC, and the ASP.NET technology in general, so, please, excuse the stupidity of my questions. I have a lot of experience with php development and CMS customization (Drupal and

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.