From 05320dfee542c29eb279d29f9e46aec1881b56ea Mon Sep 17 00:00:00 2001 From: Tom Richter <48649665+tmr0861@users.noreply.github.com> Date: Sun, 22 Sep 2019 13:19:10 -0400 Subject: [PATCH] Update VCardHelper.cs Fixed SplitCards to return multiple cards --- src/MixERP.Net.VCards/Helpers/VCardHelper.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/MixERP.Net.VCards/Helpers/VCardHelper.cs b/src/MixERP.Net.VCards/Helpers/VCardHelper.cs index b98e798..ce698ab 100644 --- a/src/MixERP.Net.VCards/Helpers/VCardHelper.cs +++ b/src/MixERP.Net.VCards/Helpers/VCardHelper.cs @@ -6,7 +6,16 @@ public static class VCardHelper { public static string[] SplitCards(string contents) { - return Regex.Split(contents, "((BEGIN:VCARD)(.*)(END:VCARD))"); + var rx = new Regex("BEGIN:VCARD(?s)(.*?)END:VCARD"); + var matches = rx.Matches(contents); + var cards = new string[matches.Count]; + + for (var i = 0; i < matches.Count; i++) + { + cards[i] = matches[i].ToString(); + } + + return cards; } } -} \ No newline at end of file +}