Getting year from text. If you want validate textbox value - use this pattern with "^" and "$": ^((19|20)\d{2})$