Community
    • Login

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

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 3 Posters 3.0k Views 1 Watching
    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 Offline
      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 Offline
        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 Offline
          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

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors