Book a Demo

Author Topic: Regex Predefined Structure Type for Tagged Values  (Read 4615 times)

kevinlyons

  • EA Novice
  • *
  • Posts: 7
  • Karma: +1/-0
    • View Profile
Regex Predefined Structure Type for Tagged Values
« on: August 03, 2018, 11:25:41 am »
Hi fellow Sparxians,

I would like to have a Tagged Value that captures a valid email address.
I could do it with the the "Type=AddinBroadcast" but I do not want have the support issue of deploying an add-in.

I looked at the Type=Custom, with Mask and Template but this is only good for fixed length.
It reminded me of regular expression place holders, so I thought...

How about:
Type=Regex;
Pattern=validRegex;
ErrorMsg=An error message or prompt;

Then I could use the following for a valid email address:
validRegex =[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*;

So the whole thing for my email address would be:
Type=Regex;
Pattern=[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*;
ErrorMsg=Please enter a valid email address, which generally looks like '[email protected]';

Sparx would have to parse this very carefully, i.e. don't get caught out by additional = or ; characters in the regex.

This could be used for many other types of text validation when creating tagged values.

Anyone else agree, disagree, suggestions for alternatives?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Regex Predefined Structure Type for Tagged Values
« Reply #1 on: August 03, 2018, 04:00:19 pm »
Seems like a good idea

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Regex Predefined Structure Type for Tagged Values
« Reply #2 on: August 03, 2018, 06:11:39 pm »
I'd vote for a new OnEA... hook when TVs are changed. So one can implement whatever check is needed.

q.
« Last Edit: August 07, 2018, 10:52:31 am by qwerty »

kevinlyons

  • EA Novice
  • *
  • Posts: 7
  • Karma: +1/-0
    • View Profile
Re: Regex Predefined Structure Type for Tagged Values
« Reply #3 on: August 07, 2018, 09:59:12 am »
I have submitted a feature request to Sparx.