In C#, I'm receiving strings such as:
- ABC123456DEF
- 123456
- ABC123456
- 123456DEF
What I would like to do is split the numbers from the string so ideally the output for the above would be:
- 'ABC', '123456', 'DEF
- '123456'
- 'ABC', '123456'
- '123456', 'DEF'
Would someone please be able to advise the best way to handle this using Regex.Split?
Thank you.
Paul.
EDIT:
Being as I was marked down, I thought I better show what I have already. This only brings the alphanumeric's, not the numeric's:
string pattern = @"\d+";
string barcode = "ABC123456DEF";
string[] result = Regex.Split(barcode, pattern);
[A-Z]+|[0-9]+([0-9]+)|([A-Z]+), no need forRegex.Splithere