Regular expressions
No edit summary
(Automatically adding template at the end of the page.)
 
(One intermediate revision by the same user not shown)
Line 4: Line 4:
  'å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}$')
[[Category:OCL]]
[[Category:OCL]]
{{Edited|July|12|2024}}

Latest revision as of 15:45, 10 February 2024

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}$')
This page was edited 95 days ago on 02/10/2024. What links here