• Login
Community
  • Login

Insert xml row

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
5 Posts 3 Posters 600 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.
  • T
    TJ Druid
    last edited by Dec 24, 2019, 3:07 PM

    I read another post on here and tried following the instructions to use Regex to do this. But when I do the Find, nothing is found.

    My current record looks like:
    ab482928-a992-45f8-bb66-c9c121d23b3a-image.png

    I need to insert a row between PlanDetail and CustomProperties.
    <RemitProvider RemitProviderName=“Payment Center” RemitProviderTIN=“777336666” RemitProviderID=“777336666” />

    I wasn’t sure if my Find/Replace settings might need a tweak - but I tried suggestions from another thread here and had no luck:
    3c137eb5-1a15-4d1c-8e00-b802146eb0ba-image.png

    Any help will be greatly appreciated. I’m trying to help someone else on my work team.

    Thanks!

    A 1 Reply Last reply Dec 24, 2019, 4:26 PM Reply Quote 0
    • A
      Alan Kilborn @TJ Druid
      last edited by Dec 24, 2019, 4:26 PM

      @TJ-Druid

      I’d try a Find what of (?-is)(<PlanDetail.+\R)(?=\x20{4}<CustomProperties) and a Replace with of \1<RemitProvider blahblahblah />\r\n

      Replace by blahblahblah with your blahblahblah. :-)

      You’ll want to change your Search Mode to Regular expression for this.

      T 1 Reply Last reply Dec 24, 2019, 11:50 PM Reply Quote 1
      • G
        guy038
        last edited by guy038 Dec 24, 2019, 4:43 PM Dec 24, 2019, 4:36 PM

        Hello, @tj-druid, @alan-kilborn and All

        Oh ! Seemingly, Alan beat me to it ;-))

        First, just one question :

        Is the line <PlanDetail xsi:nil="true"> always identical ? ( as I suppose that you have several lines, beginning with <PlanDetail, in your current HTML file )

        If the answer is yes :

        • SEARCH <PlanDetail xsi:nil="true">\r\n

        • REPLACE <PlanDetail xsi:nil="true">\r\n\x20\x20\x20\x20<RemitProvider RemitProviderName="Payment Center" RemitProviderTIN="777336666" RemitProviderID="777336666" />\r\n

        • Tick the Wrap around option

        • Select the Extended search mode

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


        If the line, beginning with <PlanDetail, may be different : for instance <PlanDetail xsi:nil="false"> or <PlanDetail abc:nil="true"> ), I advice you to prefer the regex mode :

        • SEARCH (?-is)<PlanDetail\x20.+\R(?=\h*<CustomProperties)

        • REPLACE $0\x20\x20\x20\x20<RemitProvider RemitProviderName="Payment Center" RemitProviderTIN="777336666" RemitProviderID="777336666" />\r\n

        • Tick the Wrap around option

        • Select the Regular expression search mode

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

        Best Regards,

        guy038

        P.S. :

        Here are two links to get further documentation :

        https://npp-user-manual.org/docs/searching/

        https://community.notepad-plus-plus.org/topic/15765/faq-desk-where-to-find-regex-documentation

        T 1 Reply Last reply Dec 24, 2019, 11:52 PM Reply Quote 1
        • T
          TJ Druid @Alan Kilborn
          last edited by Dec 24, 2019, 11:50 PM

          @Alan-Kilborn Thank you! I ended up using guy038’s suggestion. But, I did start with yours.

          1 Reply Last reply Reply Quote 1
          • T
            TJ Druid @guy038
            last edited by Dec 24, 2019, 11:52 PM

            @guy038 Thank you so much. I ended up using your second suggestion. I ran into an issue because my validator did not like the new row between PlanDetail and CustomProperties, but I was able to take what you provided and put the row after CustomProperties instead. I was helping a coworker with a temporary work around and she thanks you too! Happy Holidays, I’m sure Santa will give you something good in your stocking - or at least some good Karma!

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