Prefix and suffix a text entry at start of every line

  • Hello
    Enjoy Notepad++. Much appreciated.

    I’m stumped. Needing to change following, for egs.
    1 xxx zzz
    2 aaa ddd
    (1) xxx zzz
    (2) aaa ddd

    Similarly same for last entry of every line.

    I have Googled to no avail.
    Really appreciate help thank you.

  • @Richard-Avon

    from your provided data I would assume that you are looking for

     find what:^\d
     replace with:\($0\)

    with regular expression checked.
    But it might be that the find what needs to be modified if two or more digits form a number,
    but I can’t say for sure as I don’t know how your data really looks like.


  • @Claudia-Frank
    Thanks Claudia
    I’ll try this when get back to office later today.
    My data is a bit more complex than shown above.
    100 12°15’34" 12.562 o’stones
    101 35°38’56" 17.765 p&r fence
    102 84°40’10“ 25.456 bricks

    And so on in similar fashion
    The numbers (point numbers) at beginning of each line maybe any numeral from 1 to say 1000, and random.


  • @Richard-Avon

    then replace “find with” with this one


    ^ marks that it is the start of the line
    \d it must be a digit
    and the plus sign at the end tells that it must be at least 1 digit,
    without the plus sign it is looking for exactly one digit.

    Replace with is still the same.


  • @Claudia-Frank
    Many thanks Claudia. Brilliant.
    Thanks for taking the time to explain this.
    In much appreciation

Log in to reply