Regular expressions
(Created page with "In OCL a regular expression match could be performed using regExpMatch, which will return true/false. Following example shows one way to decide if a string is a valid email a...")
 
No edit summary
Line 6: Line 6:
'åke.öberg@mdriven.se'.regExpMatch('^[a-öA-Ö0-9+_.-]+@[a-öA-Ö0-9.-]+\.[a-zA-Z]{2,3}$')
'åke.öberg@mdriven.se'.regExpMatch('^[a-öA-Ö0-9+_.-]+@[a-öA-Ö0-9.-]+\.[a-zA-Z]{2,3}$')
</code>
</code>
[[Category:OCL]]

Revision as of 13:39, 7 December 2022

This page was created by Christina on 2022-02-03. Last edited by Edgar on 2025-01-20.

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

Following example shows one way to decide if a string is a valid email adress, or not.

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