On this page:
group-repeat/  c
rx/  group?
rx/  group
rx/  and-group
rx/  or-group
rx/  special-group?
rx/  non-capture-group?
rx/  non-capture-group
rx/  nc-group
rx/  named-group?
rx/  named-group
6.1 Modes
mode/  c
rx/  with-mode

6 Grouping🔗ℹ

value

group-repeat/c : contract?

TBD

procedure

(rx/group? expr)  boolean?

  expr : string?

procedure

(rx/group expr ...+ [#:repeat repeat])  string?

  expr : string?
  repeat : group-repeat/c = 'one
TBD

Examples:
> (rx/group "cat")

"(cat)"

> (rx/group "cat" #:repeat 'optional)

"(cat)?"

procedure

(rx/and-group expr ...+ [#:repeat repeat])  string?

  expr : string?
  repeat : group-repeat/c = 'one
TBD

Examples:
> (rx/and-group "cat" "dog")

"(catdog)"

> (rx/and-group "cat" "dog" #:repeat 'optional)

"(catdog)?"

procedure

(rx/or-group expr ...+ [#:repeat repeat])  string?

  expr : string?
  repeat : group-repeat/c = 'one
TBD

Examples:
> (rx/or-group "cat" "dog")

"(cat|dog)"

> (rx/or-group "cat" "dog" #:repeat 'optional)

"(cat|dog)?"

procedure

(rx/special-group? expr)  boolean?

  expr : string?
TBD

Examples:
> (rx/special-group? (rx/group "cat"))

#f

> (rx/special-group? (rx/non-capture-group "cat"))

rx/non-capture-group: contract violation

  received: 1 argument

  expected: at least 2 non-keyword arguments

  in: (->*

       ((or/c string? symbol? char?)

        (or/c string? symbol? char?))

       (#:repeat

        (or/c

         'one

         'optional

         'zero-or-more

         'one-or-more))

       #:rest

       (listof (or/c string? symbol? char?))

       string?)

  contract from: <pkgs>/rx/main.rkt

  blaming: top-level

   (assuming the contract is correct)

  at: <pkgs>/rx/main.rkt:80:11

procedure

(rx/non-capture-group? expr)  boolean?

  expr : string?

procedure

(rx/non-capture-group expr    
  ...+    
  [#:repeat repeat])  string?
  expr : string?
  repeat : group-repeat/c = 'one

procedure

(rx/nc-group expr ...+ [#:repeat repeat])  string?

  expr : string?
  repeat : group-repeat/c = 'one
TBD

Examples:
> (rx/non-capture-group "cat")

rx/non-capture-group: contract violation

  received: 1 argument

  expected: at least 2 non-keyword arguments

  in: (->*

       ((or/c string? symbol? char?)

        (or/c string? symbol? char?))

       (#:repeat

        (or/c

         'one

         'optional

         'zero-or-more

         'one-or-more))

       #:rest

       (listof (or/c string? symbol? char?))

       string?)

  contract from: <pkgs>/rx/main.rkt

  blaming: top-level

   (assuming the contract is correct)

  at: <pkgs>/rx/main.rkt:80:11

> (rx/non-capture-group "cat" #:repeat 'optional)

rx/non-capture-group: contract violation

  received: 1 argument

  expected: at least 2 non-keyword arguments

  in: (->*

       ((or/c string? symbol? char?)

        (or/c string? symbol? char?))

       (#:repeat

        (or/c

         'one

         'optional

         'zero-or-more

         'one-or-more))

       #:rest

       (listof (or/c string? symbol? char?))

       string?)

  contract from: <pkgs>/rx/main.rkt

  blaming: top-level

   (assuming the contract is correct)

  at: <pkgs>/rx/main.rkt:80:11

> (rx/non-capture-group? (rx/non-capture-group "cat"))

rx/non-capture-group: contract violation

  received: 1 argument

  expected: at least 2 non-keyword arguments

  in: (->*

       ((or/c string? symbol? char?)

        (or/c string? symbol? char?))

       (#:repeat

        (or/c

         'one

         'optional

         'zero-or-more

         'one-or-more))

       #:rest

       (listof (or/c string? symbol? char?))

       string?)

  contract from: <pkgs>/rx/main.rkt

  blaming: top-level

   (assuming the contract is correct)

  at: <pkgs>/rx/main.rkt:80:11

procedure

(rx/named-group? expr)  boolean?

  expr : string?

procedure

(rx/named-group expr    
  ...+    
  #:name name    
  [#:repeat repeat])  string?
  expr : string?
  name : string?
  repeat : group-repeat/c = 'one
TBD

Examples:
> (rx/named-group (rx/or "cat" "dog") #:name "animal")

rx/named-group: contract violation

  received: 1 argument

  expected: at least 2 non-keyword arguments

  in: (->*

       ((or/c string? symbol? char?)

        (or/c string? symbol? char?)

        #:name

        (or/c string? symbol? char?))

       (#:repeat

        (or/c

         'one

         'optional

         'zero-or-more

         'one-or-more))

       #:rest

       (listof (or/c string? symbol? char?))

       string?)

  contract from: <pkgs>/rx/main.rkt

  blaming: top-level

   (assuming the contract is correct)

  at: <pkgs>/rx/main.rkt:74:11

> (rx/named-group (rx/or "cat" "dog") #:name "animal" #:repeat 'optional)

rx/named-group: contract violation

  received: 1 argument

  expected: at least 2 non-keyword arguments

  in: (->*

       ((or/c string? symbol? char?)

        (or/c string? symbol? char?)

        #:name

        (or/c string? symbol? char?))

       (#:repeat

        (or/c

         'one

         'optional

         'zero-or-more

         'one-or-more))

       #:rest

       (listof (or/c string? symbol? char?))

       string?)

  contract from: <pkgs>/rx/main.rkt

  blaming: top-level

   (assuming the contract is correct)

  at: <pkgs>/rx/main.rkt:74:11

> (rx/named-group? (rx/named-group (rx/or "cat" "dog") #:name "animal"))

rx/named-group: contract violation

  received: 1 argument

  expected: at least 2 non-keyword arguments

  in: (->*

       ((or/c string? symbol? char?)

        (or/c string? symbol? char?)

        #:name

        (or/c string? symbol? char?))

       (#:repeat

        (or/c

         'one

         'optional

         'zero-or-more

         'one-or-more))

       #:rest

       (listof (or/c string? symbol? char?))

       string?)

  contract from: <pkgs>/rx/main.rkt

  blaming: top-level

   (assuming the contract is correct)

  at: <pkgs>/rx/main.rkt:74:11

> (rx/special-group? (rx/named-group (rx/or "cat" "dog") #:name "animal"))

rx/named-group: contract violation

  received: 1 argument

  expected: at least 2 non-keyword arguments

  in: (->*

       ((or/c string? symbol? char?)

        (or/c string? symbol? char?)

        #:name

        (or/c string? symbol? char?))

       (#:repeat

        (or/c

         'one

         'optional

         'zero-or-more

         'one-or-more))

       #:rest

       (listof (or/c string? symbol? char?))

       string?)

  contract from: <pkgs>/rx/main.rkt

  blaming: top-level

   (assuming the contract is correct)

  at: <pkgs>/rx/main.rkt:74:11

6.1 Modes🔗ℹ

value

mode/c : contract?

TBD

procedure

(rx/with-mode expr ...+ #:mode modes)  string?

  expr : string?
  modes : (or/c mode/c (listof mode/c))
TBD

Example:
> (rx/with-mode (rx/or "cat" "dog") #:mode 'case-insensitive)

"(?i:cat|dog)"