icalendar.parser.property module#
Tools for parsing properties.
- icalendar.parser.property.split_on_unescaped_comma(text)[source]#
Split text on unescaped commas and unescape each part.
Splits only on commas not preceded by backslash. After splitting, unescapes backslash sequences in each part.
- Parameters:
text (
str) – Text with potential escaped commas (e.g., "foo\, bar,baz")- Return type:
- Returns:
List of unescaped category strings
Examples
>>> from icalendar.parser import split_on_unescaped_comma >>> split_on_unescaped_comma(r"foo\, bar,baz") ['foo, bar', 'baz'] >>> split_on_unescaped_comma("a,b,c") ['a', 'b', 'c'] >>> split_on_unescaped_comma(r"a\,b\,c") ['a,b,c'] >>> split_on_unescaped_comma(r"Work,Personal\,Urgent") ['Work', 'Personal,Urgent']
- icalendar.parser.property.split_on_unescaped_semicolon(text)[source]#
Split text on unescaped semicolons and unescape each part.
Splits only on semicolons not preceded by a backslash. After splitting, unescapes backslash sequences in each part. Used by vCard structured properties (ADR, N, ORG) per RFC 6350.
- Parameters:
text (
str) – Text with potential escaped semicolons (e.g., "field1\;with;field2")- Return type:
- Returns:
List of unescaped field strings
Examples
>>> from icalendar.parser import split_on_unescaped_semicolon >>> split_on_unescaped_semicolon(r"field1\;with;field2") ['field1;with', 'field2'] >>> split_on_unescaped_semicolon("a;b;c") ['a', 'b', 'c'] >>> split_on_unescaped_semicolon(r"a\;b\;c") ['a;b;c'] >>> split_on_unescaped_semicolon(r"PO Box 123\;Suite 200;City") ['PO Box 123;Suite 200', 'City']
- icalendar.parser.property.unescape_backslash(val)[source]#
Unescape backslash sequences in iCalendar text.
Unlike
unescape_string(), this only handles actual backslash escapes per RFC 5545, not URL encoding. This preserves URL-encoded values like%3Ain URLs.Processes backslash escape sequences in a single pass using regex matching.