I have an vCard application that needs to read vCard Data, and have found a RegularExpression which gets the FieldName, Encoding and FieldValue from the file, here it is below:
^(?<FIELDNAME>[\w-]{1,})(?:(?:;?)(?:ENCODING=(?<ENC>[^:;]*)|CHARSET=(?<CHARSET>[^:;]*))){0,2}:(?:(?<CONTENT>(?:[^\r\n]*=\r\n){1,}[^\r\n]*)|(?<CONTENT>[^\r\n]*))
This Regular Expression Reads these kind of values fine:
ORG:Company
FN;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:RoguePlanetoid
However I want it to read these values also
TEL;WORK;VOICE:0200 0000000
Without skipping them. How can I modify the RegularExpression so TEL;WORK;VOICE ends up as part of the "FIELDNAME" and 0200 0000000 is part of the "CONTENT".
I am unfamiliar with complex RegularExpressions and cannot figure out how to modify it, there is a regular expression that gets these:
^(?:TEL)([^:]*):(?<TEL>[^\r\n]*)
However it only gets the FieldName as "TEL" and I need the whole value for this so I can tell the numbers apart in my application.
If possible the Regular Expression would read the WORK and VOICE elements also like the CHARSET and ENCODING in the current regular expression, so they can treated like an Attribute and Type for example, however anything which allows the Regular Expression to read the whole TEL;WORK;VOICE as the FIELDNAME will be fine.
Edit
^(?<FIELDNAME>[^:]{1,})(?:(?:;?)(?:ENCODING=(?<ENC>[^:;]*)|CHARSET=(?<CHARSET>[^:;]*))){0,2}:(?:(?<CONTENT>(?:[^\r\n]*=\r\n){1,}[^\r\n]*)|(?<CONTENT>[^\r\n]*))
Reads up to the first Colon which covers the Whole FieldName, however it would be nice to store each SemiColon Element in a seperate item such as ATTRIBUTE or TYPE.