crandas.re¶
Regular expression matching
See: String search and regular expressions
- class crandas.re.Re(expr)¶
Bases:
object
Represents a regular expression for use with crandas.
Can be used as an argument to
CSeries.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 toCSeries.fullmatch()
)
Internally, this class is based on
PythonRegex
frompyformlang
. For more details, see here and here.- Parameters:
expr (str) – Regular expression (see above)