Skip to content

crandas.re

Regular expression matching

See the Substring search section for more information

Re(expr)

Represents a regular expression for use with crandas.

Can be used as an argument to .fullmatch().

Constructed from a string representing the regular expression

Supported operators:
  • |: union
  • *: Kleene star (zero or more)
  • +: one or more
  • ?: zero or one
  • {n}: exactly n times
  • {min,}: at least min times
  • {,max}: at most max times
  • {min,max}: at least min and at most max times
  • .: any character (note that this also matches non-printable characters)
  • (, ): regexp grouping
  • [...]: set of characters (including character ranges, e.g., [A-Za-z])
  • \d: digits (equivalent to [0-9])
  • \s: whitespace (equivalent to [\\ \t\n\r\f\v])
  • \w: alphanumeric and underscore (equivalent to [a-zA-Z0-9_])
  • (?1), (?2), ...: substring (given as additional argument to .fullmatch())

Internally, this class is based on PythonRegex from pyformlang. For more details, see here and here.

PARAMETER DESCRIPTION
expr

Regular expression (see above)

TYPE: str