All Collections
Features | Admin Users
Conditional Fields
How to validate custom fields with Regex
How to validate custom fields with Regex

Create fields with Regex to further customize your process.

Ian Castelli avatar
Written by Ian Castelli
Updated over a week ago

Reading time: 2 minutes

RegEx, an acronym that stands for Regular Expressions, is a type of programming used to match certain patterns, restricting or enabling some actions based on what is typed.

It is a secure method to identify specific characters and ensure that written information is automatically validated. In Pipefy, you can use regex in Short Text fields in a form or pipe, normally used to collect simple information, and in database (database) fields.

How to use RegEx in fields

To create a field with RegEx, all you have to do is go to fields edition in a form or phase and select Short Text. Once the field is selected, click on the Custom validation option to enable it. Okay, now you just have to enter the ReGex code in the field and save it to enable validation.

This way, only the characters you define (and in the format you choose) can be entered into the field. Check some examples of ReGex codes:

Types:

  • [abc] = a, b or c will be accepted

  • [^abc] = any character but a, b, c will be accepted

  • [a-z] = any character from a to z

  • [A-Z] = any character from A to Z **CASE SENSITIVE**

  • [a-zA-Z] = any character from a to z, not case sensitive

  • ^[0-9]*$ = any number from 0 to 9

Operators:

  • [ ]? = occurs 0 or 1 time

  • [ ]+ = occurs 1 or more times

  • [ ]* = occurs 0 or more times

  • [ ]{n} = occurs n times

  • [ ] {n, } = occurs n or more times

  • [ ] {x,y} = occurs at least x times but less than y times

RegEx Metacharacters:

  • \d = [0-9]

  • \D = [^0-9]

  • \w = [a-zA-Z_0-9] accepts any character

  • [ ]{n} = occurs n times

  • [ ] {n, } = occurs n or more times

  • [ ] {x,y} = occurs at least x times but less than y times

RegEx Special Characters:

  • “\” followed by any [\^$.|?*+(){} is used to match special characters and suppress their meaning. Example: http://www\.[a-z]+\.[a-z]{2,3}

  • “.*” matches a single character. It does not matter what character it is, except newline (\n), so “.*” will match any character. Example: google.com/[?].* will accept any value beginning with google.com/ like google.com/123%asdm/?AsdKsd?

  • “|” is equivalent to boolean ‘OR’, used to divide a regex expression into more than one part. Example: all the numbers higher than 50000 -> ^([5-9]{1,})+([0-9]{4,})+|[1-9]{6,})$

  • “^” matches position just before the first character of the string.

  • “$” matches position just after the last character of the string. Example: A field should start always with USD and end with 00 -> ^USD.*00$.

  • “()” are used to create substrings or blocks of text. Example: ^(([a-z][0-1])?(BRL[0-5]{2})+)$.

You can test other RegEx fields on RegExr and RegEx101 websites. To learn more about Regx, click here.

Learn how to make the most out of our platform with Pipefy University's 100% free courses. Join Pipefy's Community to ask questions, share ideas, give feedback about our product, and engage with other members.

Did this answer your question?