I have strings with the following pattern: 12345ABCDE6789
where each group of numbers and letters are a variable length. There will only ever be numbers and letters, no special characters.
I need a way to get the numbers up until the first letter, so that the example above would return 12345
.
My thought was I could find the string position of the first letter and then trim the string to that position. But I'm having trouble figuring out how to get that index without knowing what the character is. Other solutions I've found have had the knowledge that the first letter would be an "A" where mine could be any letter.
Is there a concise way to do this?
I do not have much experience with regex, but maybe something there would be a better solution to this problem?