Cleaning up VCARD contacts without a phone.

Categories blog

Export VCARDS on your computer, open notepad++

Ctrl+F and regex:

(?s)BEGIN:VCARD(?:(?!END:VCARD|\bTEL\b).)*END:VCARD

Save and upload them to your contacts on your phone.

Regex breakdown:

(?s)          # Allow the dot to match newlines.
BEGIN:VCARD   # Match "BEGIN:VCARD".
(?:           # Start non-capturing group.
 (?!          # Make sure we're not able to match either
  END:VCARD   # the text "END:VCARD" (we don't want to match beyond the end)
 |            # or
  \bTEL\b     # "TEL" (because we don't want them to be in the match).
 )            # End of lookahead.
 .            # Match any character (if the preceding condition is fulfilled),
)*            # repeat as needed.
END:VCARD     # Match "END:VCARD"

source