JetBrains Space Help

Regular Expressions in Custom Fields

Custom fields can be added to some team directory forms (profile, absence, team membership) and project issues to collect and display additional information.

If you want to add a custom field with a restricted input, you can use regular expressions to create an input mask that will prevent invalid entries and help people enter data into the field in the correct predefined format.

Regular expression (regex or regexp) is a pattern describing which characters can be entered into the field and the order in which they must appear. For example, you can use a regular expression to make sure that people enter correctly formatted phone numbers into a phone number field.

Regular expression syntax

A regex uses special characters to create a pattern. To write an expression, use common regex examples and the syntax cheat-sheet below: For a comprehensive regex tutorial, you can refer to or other online resources of your choice.

Character classes
.Any character except newline
[abc]Any of a, b, or c
[b-f]Character between b and f
\w \d \sWord, digit, whitespace
\W \D \SNot word, digit, whitespace
Quantifiers and Alternation
ab|cdMatch ab or cd
a{3} a{2,}Exactly three; two or more
a* a+ a?0 or more, 1 or more, 0 or 1
a{2,5}Between two and five
a+? a{2,}?Match as few as possible
^abc$Start / end of the string
\bWord boundary
Escape characters
\. \* \\

\ is used to escape special characters.

\* matches *

\t \n \rTab, linefeed, carriage return

Common regex use cases

Common email address
Must include http(s)
http(s) is optional
Phone numbers
/^(?:(?:\(?(?:00|\+)([1-4]\d\d|[1-9]\d?)\)?)?[\-\.\ \\\/]?)?((?:\(?\d{1,}\)?[\-\.\ \\\/]?){0,})(?:[\-\.\ \\\/]?(?:#|ext\.?|extension|x)[\-\.\ \\\/]?(\d+))?$/
Country code/extension is optional
Goverment-issued IDs
/^((?!219-09-9999|078-05-1120)(?!666|000|9\d{2})\d{3}-(?!00)\d{2}-(?!0{4})\d{4})|((?!219 09 9999|078 05 1120)(?!666|000|9\d{2})\d{3} (?!00)\d{2} (?!0{4})\d{4})|((?!219099999|078051120)(?!666|000|9\d{2})\d{3}(?!00)\d{2}(?!0{4})\d{4})$/
Social security number
Passport number
Whole numbers
Decimal numbers
Whole and decimal numbers
Alphanumeric characters
Alphanumeric characters without space
/^[a-zA-Z0-9 ]*$/
Alphanumeric characters with space
Date format YYYY-MM-dd using separator -
Date format dd-MM-YYYY using separators - or . or /
Date format dd-mmm-YYYY using separators - or . or /
12-hour format HH:MM. Leading 0 is optional.
/((1[0-2]|0?[1-9]):([0-5][0-9]) ?([AaPp][Mm]))/
12-hour format HH:MM. Leading 0 is optional. Meridiems AM/ PM are required.
24-hour format HH:MM. Leading 0 is required.
24-hour format HH:MM. Leading 0 is optional.
24-hour format HH:MM:SS
Last modified: 20 April 2021