• Login
Community
  • Login

Extract eMail and Telephone Nr.

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
6 Posts 3 Posters 704 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A
    Ahmed Izler
    last edited by Nov 13, 2020, 3:10 AM

    Heyllo Guys,
    i need help.
    I have a Text Document of our Costumers, i must send them eMails and Shortmessage (SMS)
    The eMails and Nr. of them are in a textfile.
    Thats like:
    vorname: Alfred
    nachname: Weber
    geburtsdatum: 17.01.1981
    Strasse: Wolfgangstraße
    HausNr: 12
    PLZ: 45598
    Wohnort: Essen
    Etage: EG
    Lage: links
    Tel: 0176048784263
    email: richardweber1m@yahoo.com
    IBAN: DE4XXXXXXXXXXXXXXXXX5
    XXXXXXXXXX
    Option 2


    BUT!
    Only that costumers with the “Option 2” entry at the end.
    Not all.
    Just with the Option2 Entry.

    If its not possible,
    give me please a command to extract all option 2 costumers, then extract the eMails of that filtered costumers.

    Greetings.

    1 Reply Last reply Reply Quote 0
    • T
      Terry R
      last edited by Terry R Nov 13, 2020, 3:29 AM Nov 13, 2020, 3:29 AM

      @Ahmed-Izler said in Extract eMail and Telephone Nr.:

      BUT!
      Only that costumers with the “Option 2”

      As you only show 1 set it makes it more difficult to establish the start and end lines, such as if a set does not have “option 2” then what is in its place.

      My initial thoughts are to put all lines for each set on 1 line then bookmark lines that have “option 2” and then remove unbookmarked lines.

      To better show the example data please supply at least 1 of each type, with and without “option 2”. Insert into your reply, then select all the examples and click on the </> button immediately above the posting window.

      Terry

      1 Reply Last reply Reply Quote 0
      • A
        Ahmed Izler
        last edited by Nov 13, 2020, 4:25 AM

        if there is no option 2 there is nothing.
        not option 1 or option 0 or something.
        just clean line.

        1 Reply Last reply Reply Quote 0
        • T
          Terry R
          last edited by Nov 13, 2020, 4:56 AM

          @Ahmed-Izler said in Extract eMail and Telephone Nr.:

          if there is no option 2 there is nothing

          I would have preferred to see examples in the black box as then we see data that isn’t affected by the posting engine.

          However going with the little you have provided, as I said I’d look to put all lines for each set onto a single line. This makes it easier to remove the data sets we don’t want. It can also be done with 1 regex (Regular expression) however often it can be difficult for the requester to fully understand and possibly support going forward.

          So the first step removes carriage return/line feeds when the next line is NOT the first one of the set. According to your one example I presume vorname is the first line. So using the Replace function we have
          Find What \R(?!vorname)
          Replace With;@@ we could use any character here so that if needed we can recreate the individual lines later. It must be a character that does NOT occur in the lines, in this case not as a pair. As This is a regex the search mode must be “Regular expression”.

          So run this on a copy of the data and then use the Mark function and type “option 2” and make sure bookmark lines is ticked. Once this is run confirm that you only have option 2 sets left.

          At this point I’d like to see some of the lines. Use the </> button so we see exactly what the data looks like and then I can provide another regex to keep just the data you want. Better yet, once you have entered the example lines, can you also provide using the same method how you want the data to look like once processed.

          Terry

          1 Reply Last reply Reply Quote 1
          • T
            Terry R
            last edited by Nov 13, 2020, 6:58 AM

            @Terry-R said in Extract eMail and Telephone Nr.:

            Once this is run confirm

            Sorry, forgot to add that once you have marked the option 2 lines then use the remove nonbookmarked lines. This removes the lines you don’t want leaving ONLY option 2 lines.

            Terry

            1 Reply Last reply Reply Quote 0
            • G
              guy038
              last edited by guy038 Nov 13, 2020, 12:55 PM Nov 13, 2020, 12:53 PM

              Hello @ahmed-izler and All,

              Here is my solution… with regexes, of course ;-))

              So, given this example, below, where :

              • Three sections, out of five, end with Option 2

              • A variable amount of empty lines, even 0, exists between sections

              • Two sections are preceded with leadings space and tabulation characters

              vorname: Alfred
              nachname: Weber
              geburtsdatum: 17.01.1981
              Strasse: Wolfgangstraße
              HausNr: 12
              PLZ: 45598
              Wohnort: Essen
              Etage: EG
              Lage: links
              Tel: 0176048784263
              email: richardweber1m@yahoo.com
              IBAN: DE4XXXXXXXXXXXXXXXXX5
              XXXXXXXXXX
              Option 2
              
              
              
              vorname: Alfred
              nachname: Weber
              geburtsdatum: 17.01.1981
              Strasse: Wolfgangstraße
              HausNr: 12
              PLZ: 45598
              Wohnort: Essen
              Etage: EG
              Lage: links
              Tel: 0176048784263
              email: richardweber1m@yahoo.com
              IBAN: DE4XXXXXXXXXXXXXXXXX5
              XXXXXXXXXX
              
              vorname: Alfred
              nachname: Weber
              geburtsdatum: 17.01.1981
              Strasse: Wolfgangstraße
              HausNr: 12
              PLZ: 45598
              Wohnort: Essen
              Etage: EG
              Lage: links
              Tel: 0176048784263
              email: richardweber1m@yahoo.com
              IBAN: DE4XXXXXXXXXXXXXXXXX5
              XXXXXXXXXX
              Option 2
                  vorname: Alfred
                  nachname: Weber
                  geburtsdatum: 17.01.1981
                  Strasse: Wolfgangstraße
                  HausNr: 12
                  PLZ: 45598
                  Wohnort: Essen
                  Etage: EG
                  Lage: links
                  Tel: 0176048784263
                  email: richardweber1m@yahoo.com
                  IBAN: DE4XXXXXXXXXXXXXXXXX5
                  XXXXXXXXXX
              
              
              
              
              
              
              	vorname: Alfred
              	nachname: Weber
              	geburtsdatum: 17.01.1981
              	Strasse: Wolfgangstraße
              	HausNr: 12
              	PLZ: 45598
              	Wohnort: Essen
              	Etage: EG
              	Lage: links
              	Tel: 0176048784263
              	email: richardweber1m@yahoo.com
              	IBAN: DE4XXXXXXXXXXXXXXXXX5
              	XXXXXXXXXX
              	Option 2
              
              • Open the Replace dialog ( Ctrl + H )

                • SEARCH (?s)^\h*vorname:.+?(\R)(\h*Tel:\h+.+?\R\h*email:\h+.+?\R).+?\R(\h*Option 2\R*)?(?=\h*vorname:|\z)

                • REPLACE ?3\2\1

                • Tick the Wrap aroud option, if necessary

                • Select the Regular expression search mode

                • Click on the Replace All button, or several times on the Replace button

              You’ll get this output, with the indentation kept :

              Tel: 0176048784263
              email: richardweber1m@yahoo.com
              
              Tel: 0176048784263
              email: richardweber1m@yahoo.com
              
              	Tel: 0176048784263
              	email: richardweber1m@yahoo.com
              

              So, @ahmed-izler, if this result is the one that you expect to, I’ll give you some hints on the regex S/R, next time !

              Best Regards

              guy038

              1 Reply Last reply Reply Quote 1
              4 out of 6
              • First post
                4/6
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors