I've got a string of file names that are delimited. I need strip off the file extension for each file in the delimited string and put it back into a string using the same type of delimiter. I'd actually like 2 versions. One uses a comma and the other uses a line break (/n) delimiter. Can you also tell me if there is an easy way to change the delimiter? I foresee getting files delimited by tabs.
Let's make this idiot proof and assume just about every poor naming convention is used (spaces, periods, underscores, dashes). The constant is the delimiter. I'll say the extension is found by finding the delimiter and backing up to the first period and stripping the period and all text up to, but not including the delimiter. What's left is a delimited string without the extensions. There won't be any spaces or junk at the end of the string. A file name shouldn't, but I'd bet I'll get a file that has a space before the period. Strip that off too. There can also be spaces around the delimiter. This text string should make someone else besides me sick. It's in Windows, so I don't care about case sensitivity.
Mess of an input string:
SQL_BACKUP_20140808_111457 - Copy.TXT,SQL_BACKUP_20140808_111439.Copy.Copy.TXT,SQL_BACKUP_20140808_ .111442.TXTX ,SQL_BACKUP_20140808_111439.hTml , SQL BACKUP_20140808_111457.LoveMyClients,SQL-BACKUP_20140808_111442 -- Copy.TXT,SQL - BACKUP_20140808_111442 - Copy - Copy.TXT
Desired output string:
SQL_BACKUP_20140808_111457 - Copy,SQL_BACKUP_20140808_111439.Copy.Copy,SQL_BACKUP_20140808_ .111442,SQL_BACKUP_20140808_111439,SQL BACKUP_20140808_111457,SQL-BACKUP_20140808_111442 -- Copy,SQL - BACKUP_20140808_111442 - Copy - Copy
p.s. I'm using MS System Center Orchestrator and it has less-than-great tools for parsing text and I don't want to pipe this out to a file and use PowerShell to modify and then read it back in. I need to do that in some places, but I want to be able to clean up this mess of a string once and work with the cleaned up string. I'll actually build an IP using this expression if I can and then share with the world.