Hello,

I'm trying to take the string names of an enumeration and make them more readable. I've found a regex that adds spaces before capitalized letters (excluding the first letter). However, I'd like to also change any underscores to hyphens.

For example, my enumeration is:
Code:
Public Enum ShapeTypes
    Cube
    Cylinder_Horizontal
    Cylinder_Vertical
    PressureVessel_Horizontal
    PressureVessel_Vertical
    Sphere
End Enum
I'd like the outputs to be:
Code:
Cube
Cylinder-Horizontal
Cylinder-Vertical
Pressure Vessel-Horizontal
Pressure Vessel-Vertical
Sphere
I'm using VB.NET and found the following code on this webpage (I used a converter to get from C#)
Code:
    Public Function Wordify(ByVal pascalCaseString As String) As String
        Dim r As New Regex("(?<=[a-z])(?<x>[A-Z])|(?<=.)(?<x>[A-Z])(?=[a-z])")
        Return r.Replace(pascalCaseString, " ${x}")
    End Function
Would I use two separate regular expressions, or is there a way to have different replacements depending on what is found? I know virtually nothing about regular expressions, but I've heard that they're extremely powerful, so I feel there should be a way to do this in a single go.