Skip to content

Instantly share code, notes, and snippets.

@emoran
Created July 20, 2021 19:34
Show Gist options
  • Save emoran/f0d9fa6dc5126a09a12b85d79823ebb2 to your computer and use it in GitHub Desktop.
Save emoran/f0d9fa6dc5126a09a12b85d79823ebb2 to your computer and use it in GitHub Desktop.
validate email in dataweave 1.0
%dw 1.0
%input payload application/json
%output application/json
%var pRegex = /^[^.][a-zA-Z0-9.!#$%&’*+\/=?^_`{|}~-]+@[a-zA-Z0-9-](?!.*?\.\.)[^_ ; ,<>\/\\]+(?:\.[a-zA-Z0-9-]+)[^.]*$/
---
payload filter ($.email != "" and $.email != null and ($.email matches pRegex))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment