• Login
Community
  • Login

Find parent tag's id if that parent tag has specific tags inside it

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
31 Posts 6 Posters 4.8k 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.
  • G
    ganesan govindarajan @guy038
    last edited by Dec 23, 2021, 4:21 AM

    Hi, @guy038

    I am really sorry about that whatever i did in this help. I didn’t realize my words harm people when reading.

    Okay let me explain little details using my little knowledge please forgive me.

    Notepad++ v8.1.9.2 (64-bit)
    Build time : Nov 21 2021 - 04:30:20
    Path : C:\Program Files\Notepad++\notepad++.exe
    Command Line :
    Admin mode : OFF
    Local Conf mode : OFF
    Cloud Config : OFF
    OS Name : Windows 10 Enterprise (64-bit)
    OS Version : 1809
    OS Build : 17763.1935
    Current ANSI codepage : 1252
    Plugins : ComparePlugin.dll DSpellCheck.dll IndentByFold.dll mimeTools.dll NppConverter.dll NppExec.dll NppExport.dll NppToolBucket.dll Python Indent.dll XMLTools.dll

    I have tried to re-iterate my words as below.

    Here is the data I currently have (“before” data):

    <task chapnbr=“71” chg=“U” func=“000” key=“TASK-710000000800”>
    <title>AAA</title>
    <para>BBAACC</para>
    <para><revst>BBAACC</para>
    </task>
    <task chapnbr=“71” chg=“U” func=“000” key=“TASK-710000000801”>
    <title>AAA</title>
    <para>BBAACC</para>
    <para>BBAACC</para>
    </task>
    <task chapnbr=“71” chg=“U” func=“000” key=“TASK-710000000805”>
    <title>AAA</title>
    <para>BBAACC</para>
    <para>BBAACC</para>
    </task>
    <task chapnbr=“71” chg=“U” func=“000” key=“TASK-710000002801”>
    <title>AAA</title>
    <para><revst>BBAACC</para>
    <para>BBAACC</para><revst><para>BBAACC</para>
    <para>BBAACC</para>
    </task>
    <task chapnbr=“71” chg=“U” func=“000” key=“TASK-710002003801”>
    <title>AAA</title>
    <para>BBAACC</para>
    <para>BBAACC</para><para>BBAACC</para>
    <para><revst>BBAACC</para>
    </task>
    <task chapnbr=“71” chg=“U” func=“000” key=“TASK-725000002801”>
    <title>AAA</title>
    <para>BBAACC</para>
    <para>BBAACC</para><para>BBAACC</para>
    <para>BBAACC</para>
    </task>
    

    Here is how I would like that data to look (“after” data):

    TASK-710000000800
    TASK-710000002801
    TASK-710002003801
    

    To accomplish this, I have tried using the following Find/Replace expressions and settings

    Find What = <revst>
    Search Mode = REGULAR EXPRESSION
    Dot Matches Newline = NOT CHECKED

    Thanks

    1 Reply Last reply Reply Quote 0
    • G
      guy038
      last edited by guy038 Dec 23, 2021, 5:34 AM Dec 23, 2021, 5:19 AM

      Hello, @ganesan-govindarajan and All,

      I suppose that your before text was this one, with the use of the normal double quote character " :

      <task chapnbr="71" chg="U" func="000" key="TASK-710000000800">
      <title>AAA</title>
      <para>BBAACC</para>
      <para><revst>BBAACC</para>
      </task>
      <task chapnbr="71" chg="U" func="000" key="TASK-710000000801">
      <title>AAA</title>
      <para>BBAACC</para>
      <para>BBAACC</para>
      </task>
      <task chapnbr="71" chg="U" func="000" key="TASK-710000000805">
      <title>AAA</title>
      <para>BBAACC</para>
      <para>BBAACC</para>
      </task>
      <task chapnbr="71" chg="U" func="000" key="TASK-710000002801">
      <title>AAA</title>
      <para><revst>BBAACC</para>
      <para>BBAACC</para><revst><para>BBAACC</para>
      <para>BBAACC</para>
      </task>
      <task chapnbr="71" chg="U" func="000" key="TASK-710002003801">
      <title>AAA</title>
      <para>BBAACC</para>
      <para>BBAACC</para><para>BBAACC</para>
      <para><revst>BBAACC</para>
      </task>
      <task chapnbr="71" chg="U" func="000" key="TASK-725000002801">
      <title>AAA</title>
      <para>BBAACC</para>
      <para>BBAACC</para><para>BBAACC</para>
      <para>BBAACC</para>
      </task>
      

      and not with the smart double quotes “ and ” ( Unicode characters \x{201C} and \x{201D} )


      If so :

      • Open the Mark dialog ( Ctrl + M )

      • Type in (?-s)\h*<task .+"\K.+(?=(?s:">((?!</task>).)+?)<revst>), in the Find what : zone

      • Tick the Bookmark line option

      • Tick the Wrap around option

      • Select the Regular expression search mode

      • Click on the Mark All button

      You’ll get this text :

      d9077364-d4d9-48c2-889c-16b17d90bf53-image.png

      • Click on the Copy Marked Text button

      • Open a new tab ( Ctrl + N )

      • Paste all the TASK-71xxxxxxxxxx items


      Now, if you really use the smart double quotes, just tell me to slightly modify the regex !

      Best Regards,

      guy038

      G 1 Reply Last reply Dec 23, 2021, 5:41 AM Reply Quote 0
      • G
        ganesan govindarajan @guy038
        last edited by ganesan govindarajan Dec 23, 2021, 5:41 AM Dec 23, 2021, 5:41 AM

        Hi @guy038

        Thanks much for the help!!

        Yes that are normal quotes not smart quotes as it is converted automatically from another application.

        But i missed to tell you one thing that after the key value there are other attributes also will be there in each task as follow,

        <task chapnbr=“71” chg=“U” func=“000” key=“TASK-710000000801” date="1234567" chg="R"..etc>
        

        Due to this, if i use the above regex i can only find first line of file.

        Please advise me how to proceed with the above regex.

        Thanks

        1 Reply Last reply Reply Quote 0
        • G
          guy038
          last edited by guy038 Dec 23, 2021, 11:04 AM Dec 23, 2021, 10:58 AM

          Hi, @ganesan-govindarajan and All,

          Ah… OK !. So, this second regex version, where I explicitly search for ths string TASK, with that exact case, becomes :

          (?-si)^\h*<task .+"\KTASK.+?(?=(?s:"((?!</task>).)+?)<revst>)

          For instance, in the text below, where, again, I changed some smart quotes to normal quotes :

          <task chapnbr="71" chg="U" func="000" key="TASK-710000000801" date="1234567" chg="R">
          <title>AAA</title>
          <para>BBAACC</para>
          <para><revst>BBAACC</para>
          </task>
          

          It’ll enlight the string TASK-710000000801


          Note that I also assume that there is only ONE key attribute in the <task ......... entire line !

          BR

          guy038

          If you would like additional information about how this regex works, just tell me !

          G 1 Reply Last reply Dec 27, 2021, 4:10 AM Reply Quote 0
          • dinkumoilD
            dinkumoil @ganesan govindarajan
            last edited by dinkumoil Dec 23, 2021, 5:44 PM Dec 23, 2021, 5:35 PM

            @ganesan-govindarajan

            Please note: The following is only true if you accidentally wrote <revst> instead of <revst/> or <revst> ... </revst>. If your document only contains <revst>, it is not a valid XML document because it lacks the related closing tag and the method I’m explaining below doesn’t work.


            A more reliable and much more hassle-free method to search for things in XML documents is XPath, a query language that was explicitely designed for that use case.

            To be able to use XPath you need to install the XML Tools plugin, available via Npp’s build-in Plugins Admin. After installing it, navigate to (menu) Plugins -> XML Tools -> Evaluate XPath expression. In the dialog box popping up, enter //task[descendant::revst]/@key into the upper input field. The plugin will generate the result in the lower ListView.

            You can copy the result to your clipboard by clicking the according button. After pasting it to an empty document, you only have to do some column selection to remove the content of the ListView’s first two columns, which are useless for you but have been copied to the clipboard as well.

            G 1 Reply Last reply Dec 27, 2021, 4:12 AM Reply Quote 4
            • G
              ganesan govindarajan @guy038
              last edited by Dec 27, 2021, 4:10 AM

              Hi @guy038,

              Thanks much for your help its working fine!!.

              Somewhat i didn’t realized that format of task may differ file to file as key attribute position is may change task to task as like below,

              <task breaknbr="00" chapnbr="71" chg="U" func="000" key="TASK-710000000800" pgblknbr="301" revdate="19950301" sectnbr="00" seq="800" subjnbr="00">
              

              Key attribute comes at 4th or 5th position or dynamically changed file to file. Due to this above regex cannot find in some of the sgm files.

              Can you please help me out on this?

              Thanks again.

              1 Reply Last reply Reply Quote 0
              • G
                ganesan govindarajan @dinkumoil
                last edited by Dec 27, 2021, 4:12 AM

                Hi @dinkumoil ,

                Thanks for asking!!

                Actually we don’t worry about the closing tag as we need to find only opening tag. Also this is a sgm file and closing tag is different “<revend>”.

                thanks.

                1 Reply Last reply Reply Quote 0
                • G
                  guy038
                  last edited by guy038 Dec 27, 2021, 4:40 AM Dec 27, 2021, 4:37 AM

                  Hello @ganesan-govindarajan and All,

                  Sorry, but I do not understand :-(

                  If I use, for instance, this text :

                  <task breaknbr="00" chapnbr="71" chg="U" func="000" key="TASK-710000000800" pgblknbr="301" revdate="19950301" sectnbr="00" seq="800" subjnbr="00">
                  <title>AAA</title>
                  <para>BBAACC</para>
                  <para><revst>BBAACC</para>
                  </task>
                  

                  The regex does mark the string TASK-710000000000 ? No difference since previously ! I probably miss some details.

                  BR

                  guy038

                  G 2 Replies Last reply Dec 27, 2021, 4:51 AM Reply Quote 0
                  • G
                    ganesan govindarajan @guy038
                    last edited by Dec 27, 2021, 4:51 AM

                    Hi @guy038 ,

                    When i tried to use the regex it is only selected the first line of file. Thats the reason, i thought the issue occurs because of task format.

                    I don’t know why it is selected only first line of file.

                    1 Reply Last reply Reply Quote 0
                    • G
                      ganesan govindarajan @guy038
                      last edited by ganesan govindarajan Dec 27, 2021, 5:01 AM Dec 27, 2021, 5:00 AM

                      Hi @guy038 ,

                      Do we need to main the same format of text as per above example underneath the “task”? because lot of contents and tags find my new file after the task element.

                      1 Reply Last reply Reply Quote 0
                      • G
                        guy038
                        last edited by guy038 Dec 27, 2021, 6:26 AM Dec 27, 2021, 6:14 AM

                        Hi, @ganesan-govindarajan and All,

                        I’ll try to briefly explain how this regex works and you should be able to verify if it meets your needs !

                        So, the regex (?-si)^\h*<task .+"\KTASK.+?(?=(?s:"((?!</task>).)+?)<revst>), used with the Mark dialog, means :

                        • From the beginning of a line, it first finds optional leading blank characters, followed with the string <task, in lower case, followed with a space char, followed by anything till a double quote ( The one right before the string TASK ! )

                        • Then the \K regex syntax resets the present search. Thus, it just looks for the string TASK, in upper case, followed with any non-null range of chars, till the nearest double quote char ( The one right after the string TASK-xxxxxxxxxx )

                        • But ONLY IF two additional conditions exist :

                          • It must be followed, further on, with a <revst> tag, first

                          • Then, it must be followed, further on, with the ending tag </task>

                        This implies that, IF the </task> string is found before a <revst> tag, the regex will not match ! )


                        Globally, it can find any TASKxx....xxx string, if it is followed, downwards, with a <revst tag then, downwards, with an ending </task> tag ! So :

                        • You may have many lines, or none, between the line <task.........> and the <revst> tag

                        • You may have many lines, or none, after the <revst> tag till the ending tag </task>

                        For instance, even the short line, below :

                        <task key="TASK:AB12345"><para><revst>BBAACC</para></task>
                        

                        Or this minimum one :

                        <task key="TASK:AB12345"><revst></task>
                        

                        would mark the string TASK:AB12345 !


                        Of course, I assume that :

                        • The part <task ................> begins a line, after possible blank characters, only

                        • The part key="TASKxxxxx" is located on a single line

                        If other cases may occur, just tell me !

                        Best Regards,

                        guy038

                        G 2 Replies Last reply Dec 27, 2021, 6:34 AM Reply Quote 0
                        • G
                          ganesan govindarajan @guy038
                          last edited by ganesan govindarajan Dec 27, 2021, 6:35 AM Dec 27, 2021, 6:34 AM

                          Hi @guy038 ,

                          Your explanation is so well!! thanks much for that!!

                          This implies that, IF the </task> string is found before a <revst> tag, the regex will not match ! )

                          Yes <revst> tag may appear before or after the <task—></task> element inside of file as other elements are also have the same <revst> tags. Is this the reason this regex is not supported?

                          1 Reply Last reply Reply Quote 0
                          • G
                            ganesan govindarajan @guy038
                            last edited by Dec 27, 2021, 6:43 AM

                            Hi @guy038

                            May be my tasks starts and ends with as below,

                            25bb546c-8a99-47b1-91b7-24b1c902b66a-image.png

                            41c695f2-182c-4a98-a08d-572bba78c4c2-image.png

                            1 Reply Last reply Reply Quote 0
                            • G
                              guy038
                              last edited by Dec 27, 2021, 8:31 AM

                              Hi, @ganesan-govindarajan,

                              Actually, if a <revst> tag is found outside a <task.....>........</task> section OR if <task ........>........</task> sections do not contain, at least, one <revst> tag, like below :

                              ...
                              <task .......>
                              ....
                              ....
                              ....
                              </task>
                              ...
                              ...
                              ...<revst>...
                              ...
                              ...
                              <task .......>
                              ....
                              ....
                              ....
                              </task>
                              ...
                              

                              The regex will not match anything ! I suppose that this behavior is the one which is expected !?


                              Now, I need additional text to get a general idea of what you need. Could you provide a real complete example, as a text, in reverse video ?

                              Could you indicate the zones to mark and the different mandatory conditions to respect ?

                              Thanks,

                              BR

                              guy038

                              G 1 Reply Last reply Feb 26, 2024, 10:32 AM Reply Quote 0
                              • G
                                ganesan govindarajan @guy038
                                last edited by ganesan govindarajan Feb 26, 2024, 10:39 AM Feb 26, 2024, 10:32 AM

                                Hi @guy038 ,

                                I really sorry for the late response.

                                I am just trying to share the real time data sample here to understand clearly.

                                <em ..............>
                                .......................
                                <task breaknbr="00" chapnbr="71" chg="U" func="200" key="TASK-712101200000" pgblknbr="801" revdate="20191115" sectnbr="21" seq="000" subjnbr="01">
                                <effect effrg="710/ALL" efftext="710/ALL"></effect>
                                <title>sample text</title>
                                <subtask breaknbr="00" chapnbr="71" chg="U" func="200" key="TASK-712101200000" pgblknbr="801" revdate="20191115" sectnbr="21" seq="000" subjnbr="01">
                                <title>sample text</title>
                                <para><revst>sample para<revend></para>.....
                                </subtask>
                                </task>
                                <task breaknbr="00" chapnbr="71" chg="U" func="200" key="TASK-712101200001" pgblknbr="801" revdate="20191115" sectnbr="21" seq="000" subjnbr="01">
                                <effect effrg="710/ALL" efftext="710/ALL"></effect>
                                <title>sample text</title>
                                <subtask breaknbr="00" chapnbr="71" chg="U" func="200" key="TASK-712101200003" pgblknbr="801" revdate="20191115" sectnbr="21" seq="000" subjnbr="01">
                                <title>sample text</title>
                                <para>sample para</para>.....
                                </subtask>
                                </task>
                                
                                .
                                .
                                .
                                .
                                .
                                .
                                .
                                .
                                </em>
                                
                                

                                As per the above example, the xml file may contain one or more task continuously. Since, I need to find <revst> in between the <task>…</task> and to get respective task “key” value. If any task does not contain <revst> tag we dont need that task’s key value.

                                In the above example, the expected output is: TASK-712101200000 as <revst> found in the first task.

                                Your previous regex works correctly but that works only for the fist instance of task and not finding rest of the instances.

                                I hope you understand . Kindly let me know if any data required.

                                Thanks for your patience!
                                Ganesan G

                                1 Reply Last reply Reply Quote 0
                                • G
                                  guy038
                                  last edited by Feb 26, 2024, 3:37 PM

                                  Hello, @ganesan-govindarajan,

                                  Indeed, it’s been a very long time since your last post, in this other topic :

                                  https://community.notepad-plus-plus.org/post/80495

                                  Which seems related to your same problem !


                                  So, from your example, I understood that you want the TASK-712101200000 value because the curent <task.........</task> section contains the <revst> tag !

                                  Now, this section contains the TASK-712101200000 value, twice. So :

                                  • Do you want the regex to match the two values TASK-############ ?

                                  • Do you want the regex to match the first TASK-############ value, only ?


                                  And, if the regex must match all the instances of the block, may this case happen :

                                  <task breaknbr="00" chapnbr="71" chg="U" func="200" key="TASK-712101200000" pgblknbr="801" revdate="20191115" sectnbr="21" seq="000" subjnbr="01">
                                  <effect effrg="710/ALL" efftext="710/ALL"></effect>
                                  <para><revst>sample para<revend></para>.....
                                  <title>sample text</title>
                                  <subtask breaknbr="00" chapnbr="71" chg="U" func="200" key="TASK-712101200000" pgblknbr="801" revdate="20191115" sectnbr="21" seq="000" subjnbr="01">
                                  <title>sample text</title>
                                  </subtask>
                                  </task>
                                  

                                  Where the <revst> tag comes after the first TASK-############, but before the second TASK-############ ?

                                  Best Regards,

                                  guy038

                                  1 Reply Last reply Reply Quote 1
                                  • G
                                    ganesan govindarajan
                                    last edited by ganesan govindarajan Feb 27, 2024, 6:24 AM Feb 27, 2024, 5:06 AM

                                    Hi @guy038 ,

                                    Thanks for the response after a long time. Yes its been a very old post that have asked for.

                                    I need your help on this!!

                                    Actually each TASK, SUBTASK’s key values are unique and does not repeat or duplicate anywhere at any case. Even though all type of element’s key values are unique. That was my typo sorry for that.

                                    In my case, I need only the TASK’s key value irrespective of other key values inside the <task>…</task> if “<revst>” tag(s) is exists.

                                    Also the existing one that i have asked and routed by you (post 80495) is not exactly match with this requirement, Thats why i have raising here.

                                    Thanks again!!
                                    Ganesan. G

                                    1 Reply Last reply Reply Quote 0
                                    • G
                                      guy038
                                      last edited by Feb 27, 2024, 10:41 AM

                                      Hi, @ganesan-govindarajan,

                                      Ah…, OK ! So, I duplicated your recent example, 3 times, giving the text below, with some leading indentations :

                                      <em ..............>
                                          .
                                          .
                                          <task breaknbr="00" chapnbr="71" chg="U" func="200" key="TASK-712101200000" pgblknbr="801" revdate="20191115" sectnbr="21" seq="000" subjnbr="01">
                                              <effect effrg="710/ALL" efftext="710/ALL"></effect>
                                              <title>sample text</title>
                                              <subtask breaknbr="00" chapnbr="71" chg="U" func="200" key="TASK-712101200002" pgblknbr="801" revdate="20191115" sectnbr="21" seq="000" subjnbr="01">
                                                  <title>sample text</title>
                                                  <para><revst>sample para<revend></para>.....
                                              </subtask>
                                          </task>
                                          
                                          <task breaknbr="00" chapnbr="71" chg="U" func="200" key="TASK-712101200001" pgblknbr="801" revdate="20191115" sectnbr="21" seq="000" subjnbr="01">
                                              <effect effrg="710/ALL" efftext="710/ALL"></effect>
                                              <title>sample text</title>
                                              <subtask breaknbr="00" chapnbr="71" chg="U" func="200" key="TASK-712101200003" pgblknbr="801" revdate="20191115" sectnbr="21" seq="000" subjnbr="01">
                                                  <title>sample text</title>
                                                  <para>sample para</para>.....
                                              </subtask>
                                          </task>
                                          
                                      
                                          <task breaknbr="00" chapnbr="71" chg="U" func="200" key="TASK-712101300000" pgblknbr="801" revdate="20191115" sectnbr="21" seq="000" subjnbr="01">
                                              <effect effrg="710/ALL" efftext="710/ALL"></effect>
                                              <title>sample text</title>
                                              <subtask breaknbr="00" chapnbr="71" chg="U" func="200" key="TASK-712101300002" pgblknbr="801" revdate="20191115" sectnbr="21" seq="000" subjnbr="01">
                                                  <title>sample text</title>
                                                  <para><revst>sample para<revend></para>.....
                                              </subtask>
                                          </task>
                                          
                                          <task breaknbr="00" chapnbr="71" chg="U" func="200" key="TASK-712101300001" pgblknbr="801" revdate="20191115" sectnbr="21" seq="000" subjnbr="01">
                                              <effect effrg="710/ALL" efftext="710/ALL"></effect>
                                              <title>sample text</title>
                                              <subtask breaknbr="00" chapnbr="71" chg="U" func="200" key="TASK-712101300003" pgblknbr="801" revdate="20191115" sectnbr="21" seq="000" subjnbr="01">
                                                  <title>sample text</title>
                                                  <para>sample para</para>.....
                                              </subtask>
                                          </task>
                                      
                                          
                                          <task breaknbr="00" chapnbr="71" chg="U" func="200" key="TASK-712101400001" pgblknbr="801" revdate="20191115" sectnbr="21" seq="000" subjnbr="01">
                                              <effect effrg="710/ALL" efftext="710/ALL"></effect>
                                              <title>sample text</title>
                                              <subtask breaknbr="00" chapnbr="71" chg="U" func="200" key="TASK-712101400003" pgblknbr="801" revdate="20191115" sectnbr="21" seq="000" subjnbr="01">
                                                  <title>sample text</title>
                                                  <para>sample para</para>.....
                                              </subtask>
                                          </task>
                                      
                                          <task breaknbr="00" chapnbr="71" chg="U" func="200" key="TASK-712101400000" pgblknbr="801" revdate="20191115" sectnbr="21" seq="000" subjnbr="01">
                                              <effect effrg="710/ALL" efftext="710/ALL"></effect>
                                              <title>sample text</title>
                                              <subtask breaknbr="00" chapnbr="71" chg="U" func="200" key="TASK-712101400002" pgblknbr="801" revdate="20191115" sectnbr="21" seq="000" subjnbr="01">
                                                  <title>sample text</title>
                                                  <para><revst>sample para<revend></para>.....
                                              </subtask>
                                          </task>
                                          .
                                          .
                                      </em>
                                      

                                      To get a fair example, I also modified, on purpose, the numbers after TASK- string, in order that they are all unique :

                                      TASK-712101200000
                                      TASK-712101200002
                                      TASK-712101200001
                                      TASK-712101200003
                                      TASK-712101300000
                                      TASK-712101300002
                                      TASK-712101300001
                                      TASK-712101300003
                                      TASK-712101400001
                                      TASK-712101400003
                                      TASK-712101400000
                                      TASK-712101400002
                                      

                                      I also swapped the two blocks of the last section, so :

                                      • The <task.... </task> block not containing the <revst> tag, comes first

                                      • The <task.... </task> block containing the <revst> tag, comes in second

                                      And finally, in the last <task.... </task> block, I move up the line <para><revst>sample para<revend></para>..... right after the line :

                                      <task breaknbr="00" chapnbr="71" chg="U" func="200" key="TASK-712101400000" pgblknbr="801" revdate="20191115" sectnbr="21" seq="000" subjnbr="01">


                                      And I still confirm that my regex, provided in my last post and reported below, does finds :

                                      • The first occurrence of the key value TASK-############, if the present <task.........</task> block does contain a <revst> tag

                                      • Do not find anything if if the present <task.........</task> block does not contain the <revst> tag

                                      SEARCH / MARK : (?-si)^\h*<task .+"\KTASK.+?(?=(?s:"((?!</task>).)+?)<revst>)


                                      To be convinced :

                                      • Paste the above text, in a new tab ( Ctrl + N )

                                      • Open the Mark dialog ( Ctrl + M )

                                      • Un-tick all box options

                                      • Tick the Wrap around option

                                      • Type in the regex (?-si)^\h*<task .+"\KTASK.+?(?=(?s:"((?!</task>).)+?)<revst>) in the Find what: zone

                                      • Select the Regular expression search mode

                                      • Click on the Mark All button

                                      => You should get the message : Mark: 3 matches in entire file

                                      • Click on the Copy Marked Text button

                                      • Paste the results in the new tab

                                      => You should get the additional text, below :

                                      TASK-712101200000
                                      TASK-712101300000
                                      TASK-712101400000
                                      

                                      Which corresponds to the first 3 occurrences, found in sections which do contain a <revst> tag !


                                      Tell me if something seems unclear or if I still misunderstood the whole story !

                                      BR

                                      guy038

                                      1 Reply Last reply Reply Quote 0
                                      • G
                                        ganesan govindarajan
                                        last edited by Feb 28, 2024, 5:24 AM

                                        Hi @guy038

                                        Thank you so much !! for the prompt responses.

                                        In the above,

                                        I also swapped the two blocks of the last section, so :
                                        
                                        The <task.... </task> block not containing the <revst> tag, comes first
                                        
                                        The <task.... </task> block containing the <revst> tag, comes in second
                                        
                                        And finally, in the last <task.... </task> block, I move up the line <para><revst>sample para<revend></para>..... right after the line :
                                        
                                        <task breaknbr="00" chapnbr="71" chg="U" func="200" key="TASK-712101400000" pgblknbr="801" revdate="20191115" sectnbr="21" seq="000" subjnbr="01">
                                        

                                        This shuffles may not possible the reason is tons of task will be there in the single file and unable to find it.

                                        Kindly clarify on this? maybe i had overlooked on this.

                                        thanks
                                        Ganesan.G

                                        1 Reply Last reply Reply Quote 0
                                        • G
                                          guy038
                                          last edited by guy038 Feb 28, 2024, 8:16 AM Feb 28, 2024, 8:14 AM

                                          Hello, @ganesan-govindarajan,

                                          Well, when I decided to modify your example, by copying it three times, then using only unique key-values, swapping the cases which does and does not match and finally moving up the line containing the <revst> tag, it was just in order to show you that my regex did work with a more general text. So just a proof, in some way !


                                          Now, I don’t want you to be upset by my modifications. So, I can just use your original text which is :

                                          <em ..............>
                                          .......................
                                          <task breaknbr="00" chapnbr="71" chg="U" func="200" key="TASK-712101200000" pgblknbr="801" revdate="20191115" sectnbr="21" seq="000" subjnbr="01">
                                          <effect effrg="710/ALL" efftext="710/ALL"></effect>
                                          <title>sample text</title>
                                          <subtask breaknbr="00" chapnbr="71" chg="U" func="200" key="TASK-712101200000" pgblknbr="801" revdate="20191115" sectnbr="21" seq="000" subjnbr="01">
                                          <title>sample text</title>
                                          <para><revst>sample para<revend></para>.....
                                          </subtask>
                                          </task>
                                          <task breaknbr="00" chapnbr="71" chg="U" func="200" key="TASK-712101200001" pgblknbr="801" revdate="20191115" sectnbr="21" seq="000" subjnbr="01">
                                          <effect effrg="710/ALL" efftext="710/ALL"></effect>
                                          <title>sample text</title>
                                          <subtask breaknbr="00" chapnbr="71" chg="U" func="200" key="TASK-712101200003" pgblknbr="801" revdate="20191115" sectnbr="21" seq="000" subjnbr="01">
                                          <title>sample text</title>
                                          <para>sample para</para>.....
                                          </subtask>
                                          </task>
                                          
                                          .
                                          .
                                          .
                                          .
                                          .
                                          .
                                          .
                                          .
                                          </em>
                                          

                                          And using my regex against the abvove text, it would find 1 occurrence only ( TASK-712101200000 ) on the first line :

                                          <task breaknbr="00" chapnbr="71" chg="U" func="200" key="TASK-712101200000" pgblknbr="801" revdate="20191115" sectnbr="21" seq="000" subjnbr="01">


                                          Now, your example cannot be qualified as a real example. I need a bunch of text of, let’s say, 100 to 500 lines in order to safely test my regex in real conditions !

                                          Best regards,

                                          guy038

                                          G 1 Reply Last reply Mar 8, 2024, 4:36 AM Reply Quote 1
                                          • First post
                                            Last post
                                          The Community of users of the Notepad++ text editor.
                                          Powered by NodeBB | Contributors