icalendar.parser.string module#

Functions for manipulating strings and bytes.

Removed in version 8.0.0: Removed escape_char, escape_string, foldline, unescape_char, unescape_string.

icalendar.parser.string.validate_token(name)[source]#

Validate that a name is a valid iCalendar token.

Checks if the name matches the RFC 5545 token syntax using the NAME regex pattern ([\w.-]+), with \w matching ASCII characters only.

Parameters:

name (str) – Required. The token name to validate.

Raises:

InvalidToken – If the name is not a valid token.

Return type:

None

Changed in version 0.0.0: Raise InvalidToken, a subclass of ValueError, and reject non-ASCII characters.