🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
Regular expressions
This page was created by Christina on 2022-02-03. Last edited by Edgar on 2025-08-31.

In OCL, a regular expression match could be performed using regExpMatch, which will return true/false.

The following example shows one way to decide whether a string is a valid email address or not.

'Ă„ke.öberg@mdriven.se'.regExpMatch('^[a-öA-Ö0-9+_.-]+@[a-öA-Ö0-9.-]+\.[a-zA-Z]{2,3}$')