Extract eMail and Telephone Nr.



  • 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.



  • @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



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



  • @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



  • @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



  • 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


Log in to reply