From ff259fe683b2a1c58294d130c54041c29f597440 Mon Sep 17 00:00:00 2001 From: Jaidyn Ann <10477760+JadedCtrl@users.noreply.github.com> Date: Mon, 5 Feb 2024 22:08:25 -0600 Subject: [PATCH] Much more efficient line-splitting --- vcarded.scm | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/vcarded.scm b/vcarded.scm index c05cd44..0a40bd4 100644 --- a/vcarded.scm +++ b/vcarded.scm @@ -32,14 +32,10 @@ (remove string-null? (string-split string "\r\n"))) -;; Create irregx-format regex for matching an unescaped character. -(define (regex-unescaped-char char-string) - `(: (neg-look-behind "\\") ,char-string)) - - -;; Splits a line into a list of key/value pairs. +;; Splits a line into a cons of the property-string and value-string. +;; … basically splits the string along the first unescaped colon (:). (define (split-vcard-line line) - (let [(split (irregex-split (regex-unescaped-char ":") line))] + (let [(split (irregex-extract "(\\\\:|[^:])*" line))] (if (>= (length split) 2) (cons (car split)