Seperate a format in rows



  • Hello all,
    So I have this kind of format of numbers and texts on my notepad++ document and I’d like to separate the the first part which is the numbers than the second part which is from @ until the ; and the last part from ; and the last and i want them in 3 different notepads? It’s kind of complicated if a lot, thank you if this is possible.

    123.456.78.0:22000@Name\Name123;name
    12.3.456.789:10000@NAME\Name-1;Name2017



  • @ph0enix

    If I were you I’d create 3 new copies of your data in 3 new Notepad++ tabs.

    Then taking each new tab in turn, do the following:

    Tab #1

    Find what zone: ^([^@]+)@(?-s).+
    Replace with zone: \1
    Wrap around checkbox: ticked
    Action: Press Replace All button

    Sample results:

    123.456.78.0:22000
    12.3.456.789:10000
    

    Tab #2

    Find what zone: ^[^@]+@([^;]+);(?-s).+
    Replace with zone: \1
    Wrap around checkbox: ticked
    Action: Press Replace All button

    Sample results:

    Name\Name123
    NAME\Name-1
    

    Tab #3

    Find what zone: (?-s)^.+?;(.+)$
    Replace with zone: \1
    Wrap around checkbox: ticked
    Action: Press Replace All button

    Sample results:

    name
    Name2017
    

    Of course, all this keys upon the @ and ; occurring in the data where the examples show…and nowhere else. It will need some changes if this is not always true



  • Hello @ph0enix, @Scott-sumner and All,

    if the general template of your data is always :

    ........@..........;......

    Here are, below, 3 other possible regex S/R. Similarly to Scott’s post, you must select the Regular expression search mode, tick the Wrap around option and click on the Replace All button. Note that the Replace with: zone is always Empty

    First regex :

    SEARCH (?-s)@.+

    REPLACE Empty

    Results :

    123.456.78.0:22000
    12.3.456.789:10000
    

    Second regex :

    SEARCH (?-s).+?@|;.+

    REPLACE Empty

    Results :

    Name\Name123
    NAME\Name-1
    

    Third regex :

    SEARCH (?-s).+;

    REPLACE Empty

    Results :

    name
    Name2017
    

    Best Regards,

    guy038


Log in to reply