Custom Fields allow you to configure your own fields specific to your business needs across various modules within Rev.io, including agents, products, customers and more! Custom Fields have several configuration options and this article will focus on one specific Field Type: Regular Expression

What is a regular expression?

A regular expression is defined as "a sequence of symbols and characters expressing a string or pattern to be searched for within a longer piece of text", but what does that mean for you? Custom Validations! Regular expressions allow you to define a specific validation for the custom field you have created, opening a universe of potential validations for a specific custom field including validations on currency input, a phone number input, numeric only input, etc. The regular expression field type will be displayed as a traditional text box but with the added validations. 

Where can I find help on regular expressions?

Regular expressions are a very common way to validate data and luckily there's a full library of potential regular expressions you might be able to use. The library of regular expressions can be found at: http://regexlib.com/

What are some examples of regular expressions?

Below you will find some common requests for validations that can be solved by regular expressions. Remember, this is not the full universe of regular expressions, just a sample of what you can do with this new powerful tool! To use an example below, simply copy the "Pattern Required" into the "Expression" field of the custom field in Rev.io. All samples below are credit of those at http://regexlib.com/

  • Currency Input (in USD)
    • Pattern required: ^\$?([0-9]{1,3},([0-9]{3},)*[0-9]{3}|[0-9]+)(.[0-9][0-9])?$
    • Sample accepted inputs: $3,023,123.34 | 9,876,453 | 123456.78

Note: If the patten match is not met, you will receive an alert indicating that the pattern match is not accurate. We know Regex isn't everyone's cup of tea, so we have a future enhancement on the way to allow you to write a custom validation message when the pattern match isn't met. We'll put it in the release notes when that is ready!

  • Phone Number Input
    • Pattern required: ((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}
    • Sample Accepted inputs: (123) 456-7890 | 123-456-7890
  • Positive Integer Only Input
    • Pattern required: ^\d+$
    • Sample Accepted inputs: 123 | 10 | 54
  • Email input
    • Pattern required: ^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$
  • Sample Accepted inputs: asmith@mactec.com | foo12@foo.edu | bob.smith@foo.tv

Are there any known limitations?

Currently the regular expression option is only available for the following:

  • Agents
  • Attachments
  • Customers
  • Inventory Types
  • Orders
  • Products
  • Services 

It is also available for any Field Layout setup, though those are currently limited to customers and contacts.