I am working in PHP and came up with this:
preg_replace('/(.*?)[Cc]-? ?[Ss]harp(.*)/i', '$1C#$2', $wgTitle) );
It is intended to catch "csharp", "c sharp", and "c-sharp" regardless of case and replace it with "C#". The trouble is I do not know how to make it catch all occurences in the string. I have tried, but end up with a huge, unwieldy string which doesn't work anyway.
Any help appreciated...