Skip to content

Instantly share code, notes, and snippets.

<flow name="xmlFTW">
<validation:is-true expression="#[payload.xml == 'rules!']" />
<validation:is-false expression="#[payload.xml == 'is hard']]" />
</flow>
<flow name="melValidation">
<choice>
<when expression="#[validator.validateEmail(payload.email)]">
<flow-ref name="sendEmail" />
</when>
<otherwise>
<logger message="no email. Try contacting the user some other way" />
</otherwise>
</choice>
</flow>
#[validator.validateEmail('mule@mulesoft.com')]
<!-- Matches Canadian PostalCode formats with or without spaces (e.g., "T2X 1V4" or "T2X1V4") -->
<validation:matches-regex expression="T2X1V4" regex="^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$" caseSensitive="true" />
#[validator.matchesRegex('T2X1V4', '^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$', true)];
#[validator.isTime('12:08 PM', 'h:mm a')]
#[validator.isTime('12:08 PM', 'h:mm a', 'US')]
#[validator.notEmpty(value)]
<validation:empty expression="#[value]" />
#[validator.isEmpty(value)]
#[validator.validateSize('John’, 1, 4)]