Question

BEGIN:VCARD
VERSION:3.0
PRODID:-//Apple Inc.//iOS 5.1//EN
N:Tom;First ;Mid;Pre;Suffg
FN:Pre First Mid Tom Suffg
NICKNAME:Nick
X-PHONETIC-FIRST-NAME:Fn
X-PHONETIC-LAST-NAME:Ln
ORG:The Organization;
TITLE:VP Investor Relations
TEL;type=WORK;type=VOICE;type=pref:003-000-11111
item1.ADR;type=WORK;type=pref:;;;test;VA;12345;
BDAY;value=date:1992-03-27
item2.X-ABDATE;type=pref:2014-03-27
item2.X-ABLabel:_$!<Anniversary>!$_
item3.X-ABDATE:2013-03-27
item3.X-ABLabel:_$!<Other>!$_
NOTE:Test note
REV:2014-03-27T10:25:11Z
UID:2DCC7DC1-04F4-4A1E-A268-80E346F610AD
END:VCARD

I need to know the regular expressions to pick out the date values (birthday, anniversary, Other).

Any help would be highly appreciated.

Eidt: i just asked to pick out the date values i am able to pick other values. The link given is not helpful for me.

Was it helpful?

Solution

What you had was quite close, but a few changes are required:

(?<strElement>(BDAY)) (:(?<strBDAY>([^\n\r]*)))
              ^    ^  ^            ^        ^ ^

The parts I pointed out above are the either unnecessary (in case of parentheses) or causing a problem.

Change the space to something like \S+ perhaps and remove the extra parens:

(?<strElement>BDAY)\S+:(?<strBDAY>[^\n\r]*)

regex101 demo

OTHER TIPS

Without DataTime validation:

\d{4}\-\d{2}\-\d{2}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top