TypeError: match() takes from 2 to 3 positional arguments but 5 were given
<p>Full Error: </p>

<pre><code>Traceback (most recent call last):
  File "N:/Computing (Programming)/Code/name.py", line 3, in &lt;module&gt;
    valid = re.match("[0-9]","[0-9]","[A-Z]","[a-z]" ,tutorGroup)
TypeError: match() takes from 2 to 3 positional arguments but 5 were given
</code></pre>

<p>My code:</p>

<pre><code>import re
tutorGroup = input("Enter your tutor group - e.g. 10: ")
valid = re.match("[0-9]","[0-9]","[A-Z]","[a-z]" ,tutorGroup)
if valid:
        print("OK!")
else:
        print("Invalid!")
</code></pre>

<p>I'm trying to search a string with a given parameter</p>

<p>The problem is, that <code>re.match</code> take 2 or 3 arguments, not 5. First the regex pattern, and the string to match. optionally it takes a 3rd argument with flags.
If you want to match a single digit or a letter, you would use <code>[0-9a-zA-Z]</code> as regex. If you want multiple letters or digits, you can use <code>[0-9a-zA-Z]+</code>. If you want a list of digits or a list of letters (but not mixed), you can use <code>([0-9]+)|[a-zA-Z]+</code>.</p>

<p>Edit: After reading your comment, the regex you want is <code>[0-9]{2}[a-zA-Z]{2}</code></p>

python