Community
    • Login

    Replace what's within X and X - list. Help needed.

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 3 Posters 2.4k 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.
    • Jessica AnderssonJ
      Jessica Andersson
      last edited by

      Hello okey this is what i need help with!

      How do i replace for example:

      [Object] Randomtext xxxx blablabla [/object]
      [Object] Randomtext yyyy blablabla [/object]

      The only thing i want to change is the TEXT inside the [object] but with a list.
      Etc a other list that have it like this:
      Emma
      Dave

      It should be added and replaced with the
      [Object] Randomtext xxxx blablabla [/object]
      [Object] Randomtext yyyy blablabla [/object]
      But only that xxxx becomes Emma and the yyyy becomes Dave.

      Thanks in advance!

      1 Reply Last reply Reply Quote 0
      • Peter BrandP
        Peter Brand
        last edited by

        Replace using a regex. Something like:
        replace \([Object\]\sRandomtext\s)(xxxx)(.*?)(\[/object\]) with $1Emma$3
        and replace \([Object\]\sRandomtext\s)(yyyy)(.*?)(\[/object\]) with $1Dave$3$4

        1 Reply Last reply Reply Quote 0
        • guy038G
          guy038
          last edited by guy038

          Hello Jessica,

          I suppose that the values Emma and Dave are part of a list of first names, aren’t they ?

          Therefore, it would be interesting to extend this S/R regex to any number of first names, that are to be replaced !

          So, could you tell us how you detect the xxxx and yyyy strings, inside a block [object]....[/object] and could you provide an short example of your text, to illustrate the changes that are needed ? Thanks !

          Best Regards,

          guy038

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