I want to allow input of birthdates in a script. Because using the calendar in the date input script component requires too many clicks, I want to use the input script component and validate it so that an input of DDMMYYYY is automatically formatted with dots as DD.MM.YYYY. I tried it with the following regex:
def format_date(input_date):
formatted_date = re.sub(r'^(\d{2})(\d{2})(\d{4})$', r'\1.\2.\3', input_date)
return formatted_date
However, when I test it in preview mode, the input field is highlighted in red, and the format is not converted. Can someone tell me how I need to formulate the regex?