Regex to verify a field entry

Hi there.
Is there any way to verify a field entry? I would like to apply a regex to different fields (email, URL, phone number…) to validate it has the correct structure.
Thanks

It may be possible, depending on what you would like to happen if the entered data did not meet the validation criteria?

Hi Chris,
Thanks for your answer. Ideally, the entry should be rejected : impossible to validate it with a message like “Invalid email address”.
If that is not possible, I can get around by creating a formula which will let the message appear near the email field in the entity window… It’s less satisfactory but I can live with it.

I see a few ways of doing something potentially useful:

  • you could create one or more formulas that check the data and give a useful message (maybe using icons for emphasis), e.g. ‘:x: Email value not acceptable’
  • instead or as well as this, you could define an automation to notify someone that an invalid entry has been provided
  • and/or you could define an automation that immediately deletes (clears) the entered data if it is not acceptable

Any of these sound interesting?

I’ll go for the first one.
Thanks for your incredible reactivity (yours and the whole Fibery team).

1 Like

You’re welcome! :grin:

Create an Action (automation) that triggers when the field is changed.

The Action can run a small script to check the new value, and CHANGE it (i.e., reject it) if necessary.

In the script if you throw an error, the error message will be displayed, and logged as a notification.

Nice suggestion :slightly_smiling_face:
Just need to be careful not to trigger any loops (like if the automation triggers on the field being updated and then goes on to update that field itself…and gets retriggered)

I certainly hope it is possible for an Automation script to change the value of the field that triggered it, without causing a loop! :thinking:

The action (in the automation) of updating will re-trigger the automation, but if you use suitable filters, you can prevent it from getting stuck in a loop.

So for example, this rule will cause a loop:

but this one won’t: