Skip to main content
Skip table of contents

Annex: Validation regex patterns and examples

String validation regex pattern (e.g., for header fields)

Value matching for strings (e.g. header field keys and values) is case-sensitive.

Example
For header field values, only the exact spelling matches: “URGENT MAIL” in the subject does
not match a condition referring to the value “urgent mail”.

Wildcards
For every condition, max. one asterisk (*) and max. eight question marks (?) may be
included. An asterisk replaces zero or any one or more characters, a question mark replaces zero or
exactly one character.

Regex patterns

TEXT
String:
  type: string
  minLength: 1
  maxLength: 256
  pattern: ^[\x0A -~]+$

String with wildcards:
  type: string
  minLength: 1
  maxLength: 256
  allOf:
    - pattern: ^[\x0A -~]+$
    - pattern: ^[^\][\]?[^\]*$
    - pattern: ^([^?][?]){0,8}[^?]$

Email address and domain validation regex patterns

Value matching for email addresses and domains is NOT case-sensitive, so it doesn’t matter if you are using capital or small letters.

Example
A condition including “Foo@BAR.com” matches the value “foo@bar.com”.

Wildcards
For every condition, max. one asterisk (*) and max. eight question marks (?) may be included. An asterisk replaces zero or any one or more characters, a question mark replaces zero or exactly one character.

Regex patterns

TEXT
Email address:
  type: string
  minLength: 5
  maxLength: 256
  pattern:
    ([!#$%&'+/=?^{|}~a-zA-Z0-9_-]+\\.)*[!#$%&'*+/=?^_{|}~a-zA-Z0-9-]+@([a-zA-
    Z0-9]+[-]+)[a-zA-Z0-9]+\.(([a-zA-Z0-9]+[-]+)[a-zA-Z0-9]+\.)[a-zA-Z0-9]+

Email address with wildcards:
  type: string
  minLength: 5
  maxLength: 256
  allOf:
    - pattern:
      ([!#$%&'*+/=?^{|}~a-zA-Z0-9_-]+\\.)*[!#$%&'*+/=?^_{|}~a-zA-Z0-9-
      ]+@(([?\a-zA-Z0-9]+[-]+)[?\*a-zA-Z0-9]+\.(([?\a-zA-Z0-9]+[-]+)[?\a-zA-
      Z0-9]+\.)[?\a-zA-Z0-9]+|\)
    - pattern: ^[^\][\]?[^\]*$
    - pattern: ^([^?][?]){0,8}[^?]$

Domain:
  type: string
  minLength: 3
  maxLength: 253
  pattern: ^(([a-zA-Z0-9]+[-]+)[a-zA-Z0-9]+\.)+([a-zA-Z0-9]+[-]+)[a-zA-Z0-9]+$

Domain with wildcards:
  type: string
  minLength: 3
  maxLength: 253
  allOf:
    - pattern:
      ^(([?\a-zA-Z0-9]+[-]+)[?\*a-zA-Z0-9]+\.)+([?\a-zA-Z0-9]+[-]+)[?\*a-zA-Z0-9]+$
    - pattern: ^[^\][\]?[^\]*$
    - pattern: ^([^?][?]){0,8}[^?]$

Email address validation – examples

Valid email address values (wildcards only working with operator Matches/MatchesNot):

  • sender??@example.com

  • sender??@.example.com

  • sender??@example.

  • sender@example.com

  • sender??@exhttp://le.com

  • !#$%&'*+-/=?^_`{|}~.test@rrr123.de

  • t-es-t@r-r-r-1-2-3.de

  • test1234.567890@rrr123.de

  • test@rrr-123.com-de

  • @rrr.de

  • test@.de.com

  • test@rrr.*

  • test@.de

  • ??st@.co.??

Invalid email address values:

  • ..@rrr123.de

  • test.@rrr123.de

  • .test@rrr123.de

  • test..test@rrr123.de

  • test@rrr123..de

  • test@rrr.de.

  • @.de

  • ?@.rrr.de

  • test?????????@rrr.de

Domain validation – examples

Valid domain values (wildcards only working with operator Matches/MatchesNot):

  • rrr123.de

  • r-r-r-1-2-3.de

  • rrr----123.de

  • .de.us

  • rrr.

  • rrr..de

  • *.de

  • *.sad-eu.com

Invalid domain values:

  • rrr123..de

  • http://rrr.de

  • .rrr123.de

  • -rrr.de

  • rrr.de-

  • rrr.uk.

  • r_rr123.de

  • -retarus..com

  • test..

  • te**.de

  • -.com

IP address validation regex pattern

Wildcards: For every condition, max. one asterisk (*) and max. eight question marks (?) may be included. An asterisk replaces zero or any one or more characters, a question mark replaces zero or exactly one character.

Regex patterns

TEXT
Source IP:
  type: string
  minLength: 7
  maxLength: 15
  pattern:
  ^((25[0-5]|2[0-4][0-9]|1?[1-9]?[0-9]|10[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1?[1-9]?
  [0-9]|10[0-9])$
  
Source IP with wildcards:
  type: string
  minLength: 7
  maxLength: 15
  allOf:
    - pattern:
      ^(((\*|[1-9?][0-9?]{0,2}|0)\.){3}(\*|[1-9?][0-9?]{0,2}|0)|\*\.(([1-9?]
      [0-9?]{0,2}|0)\.)?([1-9?][0-9?]{0,2}|0)|([1-9?][0-9?]{0,2}|0)\.\*\.([1-9?][0-9?]{0,2}|0)|(([1-9?][0-9?]{0,2}|0)\.){1,2}\*)$
    - pattern: ^[^\*]*[\*]?[^\*]*$
    - pattern: ^([^?]*[?]){0,8}[^?]*$

IP address validation – examples

Valid IP address values (wildcards only working with operator Matches/MatchesNot):

  • 1.1.1.1

  • 100.100.100.100

  • 100.100.1.*

  • 100.1.*

  • .1

  • 1..1

  • 1.1..1

  • 1.?.???.1

  • ?.1.1.??

  • 1.??.

Invalid IP address values:

  • 1

  • 1.1

  • 1.1.1

  • 1.01.1.1

  • 1.1000.1.1

  • 1.1.1*

  • .1.1.

  • 1.**.1.1

  • ???.???.???.1

  • 1.????.1.1

  • Private or reserved IP addresses

Relay host validation regex pattern

Value matching for relay host addresses is NOT case-sensitive, so it doesn’t matter if you are using
capital or small letters.

Regex patterns

TEXT
RelayHost:
  type: string
  minLength: 3
  maxLength: 253
  anyOf:
  - allOf:
    - pattern:
      ^([0-9a-zA-Z]([0-9a-zA-Z-]*[0-9a-zA-Z])?)(\.[0-9a-zA-Z]([0-9a-zA-Z-]*
      [0-9a-zA-Z])?)*(\.[0-9a-zA-Z]*[a-zA-Z][0-9a-zA-Z]*)(\.)?(:(6[0-4][0-9]
      {3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]|[1-5][0-9]{4}|[1-9][0-9]{0,3}
      |0))?$
    - not:
      pattern:
      ^((localhost|.+\.retloc)(:(6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]
      |6553[0-5]|[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))?)$
  - allOf:
    - pattern:
      ^((25[0-5]|2[0-4][0-9]|1?[1-9]?[0-9]|10[0-9])\.){3}(25[0-5]|2[0-4][0-9]
      |1?[1-9]?[0-9]|10[0-9])(:(6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553
      [0-5]|[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))?$
    - not:
      pattern:
        ^(((0(\.[0-9]{1,3}){3})|(10(\.[0-9]{1,3}){3})|(100\.(6[4-9]|[7-9][0-9]
        |1[0-1][0-9]|12[0-7])(\.[0-9]{1,3}){2})|(127(\.[0-9]{1,3}){3})|
        (169\.254(\.[0-9]{1,3}){2})|(172\.(1[6-9]|2[0-9]|3[0-1])(\.[0-9]{1,3})
        {2})|(192\.0\.0\.[0-9]{1,3})|(192\.0\.2\.[0-9]{1,3})|(192\.88\.99\.[0-9]
        {1,3})|(192\.168(\.[0-9]{1,3}){2})|(198\.1[8-9](\.[0-9]{1,3}){2})|
        (198\.51\.100\.[0-9]{1,3})|(203\.0\.113\.[0-9]{1,3})|((22[4-9]|2[3-4]
        [0-9]|25[0-5])(\.[0-9]{1,3}){3}))(:(6[0-4][0-9]{3}|65[0-4][0-9]{2}|655
        [0-2][0-9]|6553[0-5]|[1-5][0-9]{4}|[1-9][0-9]{0,3}|0))?)$

Relay host validation – examples

Valid host name values:

  • http://test.de

  • foo.bar:25

  • subdomain.foobar.de:2525

  • example.com:77777

  • relay.rrr123.de

  • Any IP v4 address (without private or reserved IP addresses)

Invalid host name values:

  • test..de

  • http://subdomain.com

  • test.de:27847

  • .sdg.test.de:25

  • test:24

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.