• Login
Community
  • Login

Search with wildcards

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
11 Posts 3 Posters 1.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.
  • D
    Diego Sabah
    last edited by Apr 26, 2019, 4:50 PM

    Hi all.

    I want to search and replace in a text file all the text that starts with <table and ends with </table>.

    Can someone help me how to do it using regular expressions in notepad ++?

    Thank you!!

    D.

    A 1 Reply Last reply Apr 26, 2019, 5:34 PM Reply Quote 0
    • A
      Alan Kilborn @Diego Sabah
      last edited by Apr 26, 2019, 5:34 PM

      @Diego-Sabah

      I’d certainly give this a go as a first shot:

      Find (?s)<table>.*?</table>
      Replace wtf_knows
      Search mode: Reg. expression

      D 1 Reply Last reply Apr 26, 2019, 8:25 PM Reply Quote 3
      • D
        Diego Sabah
        last edited by Apr 26, 2019, 7:56 PM

        Hello Alan Kilborn that exprecion worked impeccable !!! Thank you very very much!!

        I need help with another expression more please.
        I want to find and replace all the text that starts with <img have in the middle youtube.com and end with >

        Can someone help me how to do it using regular expressions in notepad ++?

        M 1 Reply Last reply Apr 26, 2019, 8:22 PM Reply Quote 0
        • M
          Meta Chuh moderator @Diego Sabah
          last edited by Apr 26, 2019, 8:22 PM

          @Diego-Sabah

          I need help with another expression more please.

          i could literarily smell this coming 😂

          find what: <img(.*?)youtube.com(.*?)>
          replace with: wtf_knows

          best regards

          D 1 Reply Last reply Apr 26, 2019, 8:45 PM Reply Quote 1
          • D
            Diego Sabah @Alan Kilborn
            last edited by Apr 26, 2019, 8:25 PM

            Hello @Alan-Kilborn that exprecion worked impeccable !!! Thank you very very much!!

            I need help with another expression please.
            I want to find and replace all the text that starts with <img have in the middle youtube.com and end with >

            Can someone help me how to do it using regular expressions in notepad ++?

            M 1 Reply Last reply Apr 26, 2019, 8:31 PM Reply Quote 0
            • M
              Meta Chuh moderator @Diego Sabah
              last edited by Apr 26, 2019, 8:31 PM

              @Diego-Sabah

              I need help with another expression more please.

              i could literarily smell this coming 😂

              find what: <img(.*?)youtube.com(.*?)>
              replace with: wtf_dejavu

              best regards

              1 Reply Last reply Reply Quote 1
              • D
                Diego Sabah @Meta Chuh
                last edited by Apr 26, 2019, 8:45 PM

                Hi @Meta-Chuh said:

                <img(.?)youtube.com(.?)>

                THANK YOU for your quick response Meta Chuh.

                Your solution works for me for some cases, but for other cases it does not.

                It does not work for the cases I have two images together. The first of the domain google.com and the second of the searched domain (in this case youtube.com)

                Example :
                <img src = "http: //www.google.com/imagenes/123.jpg ">
                <img src = “http: //www.youtube.com/imagenes/456.jpg”>

                I want to select only:
                <img src = “http: //www.youtube.com/imagenes/456.jpg”>

                But in practice, notepad selects :

                <img alt = src = "http: //www.google.com/imagenes/123.jpg ">
                <img alt = src = "http: //www.youtube.com/imagenes/456.jpg ">

                I appreciate your support

                From already thank you very much!!

                M 1 Reply Last reply Apr 26, 2019, 8:53 PM Reply Quote 1
                • M
                  Meta Chuh moderator @Diego Sabah
                  last edited by Meta Chuh Apr 26, 2019, 8:56 PM Apr 26, 2019, 8:53 PM

                  @Diego-Sabah

                  please disable . matches newline at the search mode settings.

                  D 2 Replies Last reply Apr 26, 2019, 9:06 PM Reply Quote 3
                  • D
                    Diego Sabah @Meta Chuh
                    last edited by Apr 26, 2019, 9:06 PM

                    @Meta-Chuh

                    It works like a charm. You’re a genius!!!

                    1 Reply Last reply Reply Quote 1
                    • D
                      Diego Sabah @Meta Chuh
                      last edited by Diego Sabah May 15, 2019, 11:11 PM May 15, 2019, 11:08 PM

                      Dear @Meta-Chuh , I hope that you are very well.

                      The solution you gave me worked for most of the cases.

                      However some of the images that I have are in the text like this:

                      <img alt=“”
                      src=“http://www.mysite.com/imagenes/image.jpg”>

                      and the above solution does not work.
                      Any other idea?

                      Best regards!!

                      M 1 Reply Last reply May 16, 2019, 7:17 AM Reply Quote 0
                      • M
                        Meta Chuh moderator @Diego Sabah
                        last edited by May 16, 2019, 7:17 AM

                        @Diego-Sabah

                        find what: <img alt(.*?)("|"\r\n|"\n)(.*?)mysite.com(.*?)$
                        replace with: your_content

                        note: keep . matches newline disabled at the search mode settings, to avoid multi line matches.

                        best regards.

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