I'm not sure about what you posted, but if I'm understanding you right you have a character class that is acceptable between digits of a numeric value, so that "19fhuerfn4dsfjkw0" would match as it is 1940 with characters in between?
So given the character class that you want to match ([class]), you could just do this?
1[class]9[class][0-4][class][0-9]
If your number range isn't perfectly aligned with base 10, you may need to modify with a couple ors...like to make this one be 1900-1950 instead of 1900-1949 you would need to include a separate case for ending with 50.
Edited to add:
It would maybe be easier to just parse through the input character by character. Ifg it's not a digit, strip it out. When the non-digits are stripped out, parse the remaining characters as an integer and do your range check. Then check if all the stripped out characters match your accepted class with a regexp.
19sdfh2djf3
\/
sdfhdjf + 1923
\/
match(sdfhdjf) && (1900 <= 1923 <= 1950)