Regex! It is a bit of a pain to learn, but it rocks at solving problems like this. You'd use a regex patterns to match parts of an input string.
This would match the first two examples.
([A-Z]*)-([0-9]*)
This would match the third example:
(0*)([0-9]*)
This would match the last example:
([A-Z]*) ([0-9]*)
This would match either of the first two or the last one:
([A-Z]*)(-| )([0-9]*)
Further, the parentheses are used to capture the matched text. Thus, in each of these examples you could then access the prefix separate from the suffix. I.e. with first pattern, and the input AMDNY-0001253 you could pull out AMDNY and 0001253 separately.
I highly recommend RegExBuddy as a tool to help figure the patterns out.
You then use the Regex object in .NET to work with this stuff:
Dim re As New Regex("(?
[A-Z]*)-(?[0-9]*)")
Dim mc As MatchCollection = re.Matches("AMDNY-0001253")
Dim m As Match = mc(0)
Dim prodGroup as Group = m.Groups("prodgroup")
Dim delimGroup as Group = m.Groups("delimiter")
Dim idGroup as Group = m.Groups("id")
MessageBox.Show(prodGroup.Value)
MessageBox.Show(idGroup.Value)Regex is a big subject, but hopefully this will get you started.