👉 In mathematics and computer science, a restriction is a condition that restricts or limits the possible values of an input variable. In programming languages like Python, JavaScript, Java, etc., a string can have restrictions on its length, characters it can contain, or how many times certain characters can be repeated.