regex - Remove all contacts with only emails using notepad++ -


in notepad++, how can remove entries have following structure.

begin:vcard version:2.1 email;internet:example@example.com end:vcard 

note: example@example.com email address.

i've exported whole file of contacts in vcf format, , remove ones have email addresses without phone number (like seen above).

is there way in notepad++? maybe using regex search , replace feature?

(?s)begin:vcard(?:(?!end:vcard|\btel\b).)*end:vcard 

will match vcards if don't contain tel entry.

explanation:

(?s)          # allow dot match newlines. begin:vcard   # match "begin:vcard". (?:           # start non-capturing group.  (?!          # make sure we're not able match either   end:vcard   # text "end:vcard" (we don't want match beyond end)  |            # or   \btel\b     # "tel" (because don't want them in match).  )            # end of lookahead.  .            # match character (if preceding condition fulfilled), )*            # repeat needed. end:vcard     # match "end:vcard" 

i'm assuming vcards have @ least email address in them, or need filter those?


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -