Community
    • Login

    Help for mass replacement.

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    mass replacemenhelp
    2 Posts 2 Posters 620 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.
    • Владимир АнтониковВ Offline
      Владимир Антоников
      last edited by

      Hello.

      I need help!

      There is a design type:

      <a href=“/wp-content/uploads/2018/10/2-2.jpg”><img src=“/wp-content/uploads/2018/10/2-2.jpg” alt=“Ergobag1111” width=“1000” height=“708” class=“aligncenter size-full wp-image-21814” /></a>

      <a href=“/wp-content/uploads/2018/10/3-2.jpg”><img src=“/wp-content/uploads/2018/10/3-2.jpg” alt=“Ergobag2222” width=“1100” height=“652” class=“aligncenter size-full wp-image-21815” /></a>

      <a href=“/wp-content/uploads/2018/10/4-2.jpg”><img src=“/wp-content/uploads/2018/10/4-2.jpg” alt=“Ergobag3333” width=“1200” height=“497” class=“aligncenter size-full wp-image-21816” /></a>

      We need to redo it into the next view:

      <a href=“/wp-content/uploads/2018/10/2-2.jpg” class=“item” style=“background-image: url(‘/wp-content/uploads/2018/10/2-2.jpg’)” data-alt=“Ergobag1111” ></a>

      <a href=“/wp-content/uploads/2018/10/3-2.jpg” class=“item” style=“background-image: url(‘/wp-content/uploads/2018/10/3-2.jpg’)” data-alt=“Ergobag2222” ></a>

      <a href=“/wp-content/uploads/2018/10/4-2.jpg” class=“item” style=“background-image: url(‘/wp-content/uploads/2018/10/4-2.jpg’)” data-alt=“Ergobag3333” ></a>

      I tried to make it a team:

      (“><img src=”)|(" width=“." height=".” class=“.* /></a>)|(” width=“." height=".” class=".* /></a>)

      (?1" class=“item” style=“background-image: url(‘)(?2’)” data-alt=“)(?3” ></a>)

      But it does not work correctly.

      I want to do exactly that the replacement occurred as a team.

      Please, help!

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

        Hello, владимир-антониковn, and All,

        Assuming that your XML text uses :

        • Regular Simple quote ( ' ), of Unicode value \x{0027}, and not the characters ‘ and ’

        • Regular Double quote ( " ), of Unicode value \x{0022}, and not the characters “ and ”

        These changes of text can be easily done with regular expressions :-))


        • Open the Replace dialog ( Ctrl + H )

        • SEARCH ><img src="(.*?)"\x20(alt=".+?").+?\x20/(></a>)

        • REPLACE \x20class="item"\x20style="background-image:\x20url\('\1'\)"\x20data-\2\x20\3

        • Tick, preferably, the Wrap around option

        • Select the Regular expression search mode

        • Click, once on the Replace All button or several times on the Replace button

        Et voilà !

        If OK, I’ll give you some explanations on that regex S/R, next time

        Best Regards

        guy038

        1 Reply Last reply Reply Quote 2

        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