Chercher et remplacer des caractères alignés verticalement



  • Bonjour,

    J’ai un gros soucis et j’aimerais avoir une réponse urgente.

    Je travaille sur un gros fichier .txt et je voudrais donc remplacer une suite des données alignées verticalement et je ne sais pas vraiment comment m’y prendre:

    les caractères se presentent actuellement ainsi:

    1
    8
    1
    1

    et je voudrais avoir ça:

    1
    7
    1
    1

    Merci de me venir en aide



  • @hamadou-mana,

    Hello,

    I have a big problem and I would like an urgent answer.

    I am working on a large .txt file so I would like to replace a suite of vertically aligned data and do not really know how to do it:

    the characters present themselves as follows:

    1
    8
    1
    1
    

    and I would like to have this:

    1
    7
    1
    1
    

    Thank you for helping me

    Assuming that’s literally all you have, it would be easy enough

    • find = 1(\R)8\11\11
    • replace = 1${1}7${1}1${1}1
    • search mode = regular expression

    The (\R) matches any newline, and saves it into “group 1”. The \1 in the find-expression refers to the value of group1. The ${1} in the replace expression does the same.

    If you’ve really got something that is more complicated than that (for example, multiple columns of data, or a non-constant search and/or replace, instead of always 18111711), you will have to give us a better example of what should and what shouldn’t change, with example data that more fully matches your needs. When giving example data, please highlight it and click the </> button, which will mark it up as “code”, so that the forum doesn’t interpret special characters as Markdown and thus use it for rendering your post; as code, the forum will present the exact data you paste.

    Please also study the official Notepad++ regex docs, as well as other resources listed in this forum FAQ


Log in to reply