- A regular expression is a method used in programming for pattern matching. Regular expressions provide a flexible and concise means to match strings of text.
- Following is the answer:
import redef is_allowed_specific_char(string):
charRe = re.compile(r'[^a-zA-Z0-9.]')
string = charRe.search(string)
return not bool(string)
print(is_allowed_specific_char("ABCDEFabcdef123450"))
print(is_allowed_specific_char("*&%@#!}{"))
- Answer: a.
re is a part of the standard library and can be imported using import re.
- Answer: a.
It will look for the pattern at the beginning and return None if it isn't found. - Answer: d.
This function returns the entire match.