Given a value I want to validate it to check if it is a valid year. My criteria is simple where the value should be an integer with 4 characters. I know this is
4
To test a year in a string which contains other words along with the year you can use the following regex: \b\d{4}\b