Hi everyone, is there any function to validate ema...
# community-help
f
Hi everyone, is there any function to validate email format, like the one for IP (
IS_IP_ADDRESS
)? TBH don't really want to regex it πŸ™‚
m
Email regex is notoriously hard! I think that's the only approach - but we fortunately have a few examples e.g.
Copy code
{
  "agents": [
    {
      "disabled": false,
      "name": "Trigger if Field Matches Regex",
      "options": "{\"rules\":[{\"type\":\"regex\",\"path\":\"{{email_address.body}}\",\"value\":\"\\\\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\\\.[a-zA-Z]{2,4}\\\\b\"}]}",
      "position": {
        "x": 2100,
        "y": 1425
      },
      "type": "trigger"
    },
    {
      "disabled": false,
      "name": "Email Address",
      "options": "{\"mode\":\"message_only\",\"loop\":false,\"payload\":{\"body\":\"<mailto:thomas@tines.io|thomas@tines.io>\"}}",
      "position": {
        "x": 2100,
        "y": 1290
      },
      "type": "eventTransformation"
    },
    {
      "disabled": false,
      "name": "Not Email Address",
      "options": "{\"mode\":\"message_only\",\"loop\":false,\"payload\":{\"body\":\"Thomas Kinsella\"}}",
      "position": {
        "x": 2370,
        "y": 1290
      },
      "type": "eventTransformation"
    },
    {
      "disabled": false,
      "name": "Trigger if Field Matches Regex",
      "options": "{\"rules\":[{\"type\":\"regex\",\"path\":\"{{not_email_address.body}}\",\"value\":\"\\\\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\\\.[a-zA-Z]{2,4}\\\\b\"}]}",
      "position": {
        "x": 2370,
        "y": 1425
      },
      "type": "trigger"
    }
  ],
  "links": [
    {
      "sourceIdentifier": 2,
      "receiverIdentifier": 3
    }
  ],
  "diagramNotes": []
}
a
Rare you see company founders and COO's get this involved with the community using their product. Gotta love this.
f
You are right @alert-rain-18576. Thanks @modern-farmer-99434 for your reactivity πŸ‘
r
Only thing I'd suggest is that there are some >4-character TLDs out there that could conceivably originate email. Might need to change the final portion of the regex to be
[a-zA-Z]{2,}
m
There is no 100% correct email regex. We messed up email when we allowed arbitrary TLDs 🀷
f
You understand why I didn't want to go for it... πŸ™‚