Define a Regular expression in one place and use it - Mendix Forum

Define a Regular expression in one place and use it

56

In the modeler, we can check regular expression as follows:
- Entity validation Rule:
  we can only use regular expression material as regular expression.

- input widget validation expression: 
  we can only use string value as regular expression. 
  e.g)
   isMatch($value,'^[0-9]+')
  
- Rule or microflow:
  we can use string value, Constant value and Enumeration's caption value. but we cannot use regular expression material's value.
  e.g)
   isMatch($value, '^[0-9]+'),
   isMatch($value, @sample.regxConstValue)
   isMatch($value, getCaption(sample.EnumerationRegx.value))
   we cannot use isMatch($value, regular expression material's value).


I would like to define a regular expression in one place and use it.
Idea as follows:
- Would it be possible that mendix allow to use regular expression material's value in all validation 
scene(e.g. Entity validation rule , input widget validation expression , Rule, microflow) ?
- Would it be possible that mendix allow to use Enumeration's caption value in all validation scene?


 

asked
6 answers

Hi, I ran into the same question today and looked up for an option to have a single occurrence for all my regular expressions. It would be really helpful to use Regex Objects in Microflows/Rules OR to use Constants in Regex Objects. Therefore a clear ”+1” for this idea.

Created

I need this :-)

Created

Isn't this covered by Constants now? As you can make them available in client too.

Created

I read somewhere Mendix wants to focus on the core. This should certainly qualify.

Now, I don’t use Regex at all; just re-using Rule, which does the RegEx

Created

Submitted two years ago. Still not implemented?

Created

Totally agree.

You should define the regexes in one place only: the Regex materials.

You should be able to use them anywhere.

Created