Here are some tips that might help you on your way:
-
In perldoc perlre, carefully review the //g, //c, //s and //m modifiers. Also consider the difference between using a regex in a scalar vs. a list context.
-
Yes, there is such a thing as “regex golf,” which is the amusing geek-pasttime of trying to Name That Tune In One Note. But clarity usually wins the race, and if that means writing several regexes and breaking down the string in several stages ... do so. After all, after you write the thing, you will also be maintaining it.
-
The join operator is very handy for constructing “comma-delimited strings.”
-
There are gobs of “regular expression test sites” on the Internet. Nearly all regex engines are “Perl compatible.”
-
(Just in case...)
Far from being “dismissive,” we are seriously endeavoring to help you. Attempt to solve the problem and show us your attempts. Instead of “handing you a fish,” we’d like to “teach you to fish.” This is an extremely frequently-done task that is one of the key reasons for “what is the fuss all about” with regards to Perl. String-mangling is one of the reasons why Perl is referred to as a Swiss Army Knife.®