Regex and Accepted Values

This article breaks down the regular expressions (or regex for short) Nium uses to validate characters submitted through Nium Portal and our API.

What is regex?

Regex or regular expressions are patterns used to match a specific set of characters and symbols in strings of text or code.

Nium uses regex to define which characters our web app (https://app.nium.com/) and our API accept. Defining what characters and data can be submitted helps ensure only accurate information gets passed through and no issues come up when moving funds.

For example, Nium uses regex to make sure special symbols like $ are not passed in fields like postal code or region.

For more information about regex, see the following developer guide from Mozilla.

What does ^[a-zA-Z0-9_.,-\s] mean in the API reference?

^[a-zA-Z0-9_.,-\s] is one of the stricter examples of a regex statement Nium uses to define what characters are accepted by Nium Portal and our API.

When broken down, each set of characters in the above regex statement details and defines what characters are accepted by Nium's API: ^[a-zA-Z0-9_.,-\s]

CharactersDescriptionRegex
Caret (^) symbolThe caret symbol (^) defines when the character validation statement begins; right at the very beginning of the submitted input. In other words, the caret (^) is the character used to begin a regex statement. You can ignore this character when considering what characters can be accepted by Nium's API.^
Lowercase characters - a-zThis portion of the regex statement defines what case of characters (lowercase v. uppercase) are accepted by Nium's API. This statement defines the set of characters we consider valid in the submitted input.

More specifically, it states that lowercase characters (a,b,c,d...) are accepted by Nium's API.
[a-z
Uppercase characters - A-ZThis portion of the regex statement defines what case of characters (lowercase v. uppercase) are accepted by Nium's API. This statement defines the set of characters we consider valid in the submitted input.

More specifically, it states that uppercase characters (A,B,C,D...) are accepted by Nium's API.
A-Z
Numerical characters - 0-9This portion of the regex statement defines what numbers are accepted by Nium's API. This statement defines the set of numerical characters we consider valid in the submitted input.

More specifically, it states that numbers (0,1,2,3...) are accepted by Nium's API.
0-9
Underscore - _This portion of the regex statement enables the underscore character (_) to be accepted by Nium's API._
Period - .This portion of the regex statement enables the period character (.) to be accepted by Nium's API.,
Comma - ,This portion of the regex statement enables the comma character (,) to be accepted by Nium's API.-
Blank spaces - This portion of the regex statement enables the blank spaces ( ) to be accepted by Nium's API.\s]