Using Forms Regex validation

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.

Forms Text Fields can validate a wide range of text patterns using Regex validation. Regular Expressions (Regex) are sequences of characters that define a search pattern in text. They can be used to validate text based on complex criteria and match common text patterns like phone numbers and IP addresses. Regular expressions are both flexible and powerful, capable of matching virtually any text-based pattern you might want to include in a form.

Using Regex in Forms

When you create a text question, along with word/character limits, you can validate for Regex pattern matching.  To validate a field with a Regex pattern, click the "Must match pattern" check box.

Next, add the expression you want to validate against. Then add the message your users will see if the validation fails.

if you need a full name field validator that only allows alphabetic letters and that is in the format of Name and Surname and accepts compound names.

For this, we will use the regex below:


^[a-zA-Z]+( [a-zA-Z]+)+$


(lightbulb)This Regex validator will work as shown on the screen recording below.


tip/resting Created with Sketch.

Description Property

You can save time for your users by including formatting instructions or examples in the question description.

Once you have created a form that uses Regex validation, be sure to test it. A successful form submission indicates that the Regex is valid. If the regex is not valid, you will see a message that says, "The regex pattern on this question is not valid. Answer unable to be validated". At this point, you need to return to the form builder and fix the regex pattern. If your form is deployed with an invalid regex, then users will not be able to submit the form.

For more information about the RE2 regex library and how you can use it with Forms, please refer to the topics below:

Basics

The Regex engine used by JSM Forms is based on the RE2 library. It supports most common regex syntax, but it does not support some features that are available in the JavaScript engine — most notably backreferences and lookahead / lookaround. See the full RE2 syntax reference for details.

Name

Description

Example Pattern

Example Match

.

Dot (wildcard) - any character except newline

.

forms is great

\d

Digit - Matches any digit character (0-9). Equivalent to [0-9].

file_\d\d

file_25

\w

Word - Matches any word character (alphanumeric & underscore). Only matches low-ascii characters (no accented or non-roman characters). Equivalent to [A-Za-z0-9_].

\w-\w\w\w

A-b_1

\s

Whitespace - White space: space, tab, newline

a\sb\sc

a b

c

\D

Not digit - Matches any character that is not a digit character (0-9). Equivalent to [^0-9].

\D

these-are-letters

\W

Not word - Matches any character that is not a word character (alphanumeric & underscore). Equivalent to [^A-Za-z0-9_]

\W

12345

\S

Not whitespace - Matches any character that is not a whitespace character (spaces, tabs, line breaks).

\S

anything-without-whitespace

Ranges and Sets

Name

Description

Example Pattern

Example Match

[abc]

Character set - Match any character in the set.

[airj]

jira

[^abc]

Negated set - Match any character that is not in the set.

[airj]

confluence

[a-g]

Range - Matches a character having a character code between the two specified characters inclusive.

[g-s]

ghijklmnopqrs

[^a-g]

Not range - Matches a character not in the range. 

[^g-s]

abcdeftuvwxyz

Anchors

Name

Description

Example Pattern

Example Match

^

Beginning - Matches the beginning of the string. This matches a position, not a character.

^\w+

she sells seashells

$

End - Matches the end of the string. This matches a position, not a character.

\w+$

she sells seashells

\b

Word boundary - Matches a word boundary position between a word character and non-word character or position (start / end of string). In RE2 this is an ASCII word boundary.

s\b

she sells seashells

\B

Not word boundary - Matches any position that is not a word boundary. This matches a position, not a character.

s\B

she sells seashells

Groups & Lookaround

Name

Description

Example Pattern

Example Match

(abc)

Capturing group - Groups multiple tokens together and creates a capture group for extracting a substring or using a backreference.

(ha)+

hahaha hahah!

(?!abc)

Non-capturing group — Groups multiple tokens together without creating a capture group.

(?:ha)+

hahaha haa hah!

Not supported in RE2: The RE2 engine does not support backreferences e.g. \1) or lookaround (e.g. (?=…), (?!…), (?<=…), (?<!…)).  Patterns that previously relied on these features are no longer valid and must be rewritten. In many cases these validations can be expressed without them — for example, by enumerating the allowed characters directly, or by validating the whole string with anchors.



Quantifiers & Alternation

Name

Description

Example Pattern

Example Match


+

Plus - Matches 1 or more of the preceding token.

b\w+

b be bee beer beers


Star - Matches 0 or more of the preceding token.

b\w*

b be bee beer beers

{1,3}

Quantifier - Matches the specified quantity of the previous token. {1,3} will match 1 to 3. {3} will match exactly 3. {3,} will match 3 or more.

b\w{2,3}

b be bee beer beers

?

Lazy - Makes the preceding quantifier lazy, causing it to match as few characters as possible. By default, quantifiers are greedy, and will match as many characters as possible.

b\w+?

be bebeer beers

|

Alternation - Acts like a boolean OR. Matches the expression before or after the |.

It can operate within a group, or on a whole expression. The patterns will be tested in order.


b(a|e|i)d

bad bud bod bed bid

Common Examples

Regular expressions are great for validating common input types in Jira Forms. So Forms currently includes validation for email addresses and URLs out-of-the-box. Further validation formats can be built using regex to make sure your forms always capture correctly formatted data. 

Type of Input

Pattern

Example Match

Date format

^(0?[1-9]|1[0-2])[\/](0?[1-9]|[12]\d|3[01])[\/](19|20)\d{2}$

10/2/2019
01/02/2019
10/2/19

USD currency

^(\$)(\d)+

$10
$100000
$$$10

IPv4 address

\b(?:(?:2(?:[0-4][0-9]|5[0-5])|[0-1]?[0-9]?[0-9])\.){3}(?:(?:2([0-4][0-9]|5[0-5])|[0-1]?[0-9]?[0-9]))\b

192.168.0.1

Phone number

^\s*(?:\+?(\d{1,3}))?([-. (]*(\d{3})[-. )]*)?((\d{3})[-. ]*(\d{2,4})(?:[-.x ]*(\d+))?)\s*$

0400123000

+61 0400000000

610400000000+++

Advanced Usage

As stated above, the basics of regular expressions can be combined to achieved very useful input validation. Here are some examples of advanced pattern matches using regular expressions.

Type of Input

Pattern

Example Match

The letter "C" and 7 numeric characters

^C\d{7}$

C0000001

Alphanumeric with spaces allowed.

Max length: 20 characters

^[\w\d\s]{1,20}$

12345678912345678912

123456789123456789123

abcdefghijklmnopqrst

abcdefghijklmnopqrstu

Valid email address from a specific domain and format.

^[a-zA-Z]+\.[a-zA-Z0-9]+@example.com

john.doe@example.com

john@example.com

john.doe@otherdomain.com

 

Alphanumeric according to local reference table

^[\x{0410}-\x{042F}]+[\x{0410}-\x{042F}]$

АБВГДЕЖЗ

hello

Alphanumeric
Max length: 250 characters

^\w{1,250}$

12345678weqweasdsad123123

2 letters, underline, 3 numeric

^[A-z]{2}_[0-9]{3}$

DK_003

Last modified on Aug 25, 2026

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.