Note that there are some explanatory texts on larger screens.

plurals
  1. POVCard 4.0 Phones Regex?
    text
    copied!<p>I want to read VCard 4.0 file .</p> <p>I use this sample.</p> <p>but when I use this solution for this file.</p> <pre><code>BEGIN:VCARD VERSION:4.0 N:Gump;Forrest;;; FN: Forrest Gump ORG:Bubba Gump Shrimp Co. TITLE:Shrimp Man PHOTO:http://www.example.com/dir_photos/my_photo.gif TEL;TYPE=work,voice;VALUE=uri:tel:+1-111-555-1212 TEL;TYPE=home,voice;VALUE=uri:tel:+1-404-555-1212 ADR;TYPE=work;LABEL="42 Plantation St.\nBaytown, LA 30314\nUnited States of America" :;;42 Plantation St.;Baytown;LA;30314;United States of America EMAIL:forrestgump@example.com REV:20080424T195243Z END:VCARD </code></pre> <p>it doesn't find Phone parameter - for example, I use this Regex for a phone number:</p> <pre><code> RegexOptions options = RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace; regex = new Regex(@"(\n(?&lt;strElement&gt;(TEL)) (;*(?&lt;strAttr&gt;(HOME|WORK)))* (;(?&lt;strType&gt;(VOICE|CELL|PAGER|MSG|FAX)))* (;(?&lt;strPref&gt;(PREF)))* (;[^:]*)* (:(?&lt;strValue&gt;[^\n\r]*)))", options); mc = regex.Matches(s); if (mc.Count &gt; 0) { Phones = new Phone[mc.Count]; for (int i = 0; i &lt; mc.Count; i++) { m = mc[i]; Phones[i].number = m.Groups["strValue"].Value; ss = m.Groups["strAttr"].Value; if (ss == "HOME") Phones[i].homeWorkType = HomeWorkType.home; else if (ss == "WORK") Phones[i].homeWorkType = HomeWorkType.work; if (m.Groups["strPref"].Value == "PREF") Phones[i].pref = true; ss = m.Groups["strType"].Value; if (ss == "VOICE") Phones[i].phoneType = PhoneType.VOICE; else if (ss == "CELL") Phones[i].phoneType = PhoneType.CELL; else if (ss == "PAGER") Phones[i].phoneType = PhoneType.PAGER; else if (ss == "MSG") Phones[i].phoneType = PhoneType.MSG; else if (ss == "FAX") Phones[i].phoneType = PhoneType.FAX; } } </code></pre> <p>but value of strAttr,strType in empty.</p> <p>How to set Regex for these?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload