Regex code for email address, and how to link it with my feedback form

197 Views Asked by At

I want to link my feedback form's email address and Regex to validate the email address entered by an customer

1

There are 1 best solutions below

0
On

What you probably need is a validate method. Inside your FormAction class you can define a validate_{slot_name} method which will be automatically called after the slot is successfully extracted using your defined slot mappings.

Assuming your email slot is called email your validate method name should be validate_email and would look like this:

def validate_email(
    self,
    value: Text,
    dispatcher: CollectingDispatcher,
    tracker: Tracker,
    domain: Dict[Text, Any],
) -> Dict[Text, Any]:
    """Validate email value."""

    # Your regex  validation logic...

Check this link to check an example of what you should return inside a validate_{slot_name} method.