Community
    • Login

    Is there a way to find both alphabets, with and without accents, when searching?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    9 Posts 5 Posters 205 Views 2 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.
    • Troglo37T Offline
      Troglo37
      last edited by guy038

      Another issue I’ve been dealing with is letters with accents. Many times I’ve searched for a name and couldn’t find it. Later on, I realized that it was because the name had an accent. So, I’ve had to painstakingly go through some of the names I have typed in and change the letters.

      I want to be able to copy and paste names without worrying about accents, and preferably have the correct spelling of the person’s name if they have accents.

      CoisesC 1 Reply Last reply Reply Quote 0
      • CoisesC Offline
        Coises @Troglo37
        last edited by

        @Troglo37 said:

        Another issue I’ve been dealing with is letters with accents. Many times I’ve searched for a name and couldn’t find it. Later on, I realized that it was because the name had an accent. So, I’ve had to painstakingly go through some of the names I have typed in and change the letters.

        I want to be able to copy and paste names without worrying about accents, and preferably have the correct spelling of the person’s name if they have accents.

        It has been requested before. At present there is a way, but not a convenient way.

        To search for a name like René you can use the following form as a regular expression:
        [[=r=]][[=e=]][[=n=]][[=e=]]

        Yes, it’s a pain in the butt. Maybe someday someone will make a simple switch for it. (Note to self: my still-in-progress Search++ plugin should have that as an option for plain text searches.)

        Troglo37T 1 Reply Last reply Reply Quote 1
        • Troglo37T Offline
          Troglo37 @Coises
          last edited by

          @Coises How and where do I put that?

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

            Hello, @troglo37, @coises and All,

            @troglo37, you said :

            @Coises How and where do I put that?

            Well, I’ll give you a general method which :

            • Firstly, change any stream selection, in a regex build with equivalence class expressions

            • Secondly, find any text which satisfy the complete list of these equivalent classes


            • First, we are going to add the macro, described below, within your active shortcut.xml file, right before the line containing </Macros>
                    <Macro name="Global Search" Ctrl="no" Alt="no" Shift="no" Key="0">
                        <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
                        <Action type="3" message="1601" wParam="0" lParam="0" sParam="(\w)" />
                        <Action type="3" message="1625" wParam="0" lParam="2" sParam="" />
                        <Action type="3" message="1602" wParam="0" lParam="0" sParam="(?1[[=$0=]]:$0)" />
                        <Action type="3" message="1702" wParam="0" lParam="640" sParam="" />
                        <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
                    </Macro>
            

            Reminder :

            • If you installed N++ with an installer package, your active shortcuts.xml file should be within the folder %AppData%\Notepad++

            • If you installed N++ with a portable package, your active shortcuts.xml file should be along with the Notepad++.exe file, in your install folder

            • You may also define a shortcut for this Global Search macro, by opening the Settings > Shortcut Mapper... > Macros tab and double-clicking on the Global Search line !

            Now :

            • Close and restart Notepad++

            • Paste the French text, below, in a new tab ( I rewrote the same French text in different cases ! )

            C'est là, près de la forêt, dans un gîte, où régnait un grand capharnaüm, que l'aïeul ôta sa flûte et son bâton de son canoë
            C'EST LÀ, PRÈS DE LA FORÊT, DANS UN GÎTE, OÙ RÉGNAIT UN GRAND CAPHARNAÜM, QUE L'AÏEUL ÔTA SA FLÛTE ET SON BÂTON DE SON CANOË
            C'est Là, Près De La Forêt, Dans Un Gîte, Où Régnait Un Grand Capharnaüm, Que L'aïeul Ôta Sa Flûte Et Son Bâton De Son Canoë
            C'Est Là, près DE LA FORêT, dAns Un gÎte, OÙ rÉgNaIT Un GRaND cAPHaRnaÜM, QUE L'aïEul ôta sa flÛtE et sON bÂTon de soN caNoË
            
            • Switch to that new tab

            • Select all the contents of the very first line

            • Run the Macro > Global Search macro

            You should get, at once, this selected OUTPUT

            [[=C=]]'[[=e=]][[=s=]][[=t=]] [[=l=]][[=à=]], [[=p=]][[=r=]][[=è=]][[=s=]] [[=d=]][[=e=]] [[=l=]][[=a=]] [[=f=]][[=o=]][[=r=]][[=ê=]][[=t=]], [[=d=]][[=a=]][[=n=]][[=s=]] [[=u=]][[=n=]] [[=g=]][[=î=]][[=t=]][[=e=]], [[=o=]][[=ù=]] [[=r=]][[=é=]][[=g=]][[=n=]][[=a=]][[=i=]][[=t=]] [[=u=]][[=n=]] [[=g=]][[=r=]][[=a=]][[=n=]][[=d=]] [[=c=]][[=a=]][[=p=]][[=h=]][[=a=]][[=r=]][[=n=]][[=a=]][[=ü=]][[=m=]], [[=q=]][[=u=]][[=e=]] [[=l=]]'[[=a=]][[=ï=]][[=e=]][[=u=]][[=l=]] [[=ô=]][[=t=]][[=a=]] [[=s=]][[=a=]] [[=f=]][[=l=]][[=û=]][[=t=]][[=e=]] [[=e=]][[=t=]] [[=s=]][[=o=]][[=n=]] [[=b=]][[=â=]][[=t=]][[=o=]][[=n=]] [[=d=]][[=e=]] [[=s=]][[=o=]][[=n=]] [[=c=]][[=a=]][[=n=]][[=o=]][[=ë=]]
            
            • Immediately, open the Find dialog ( Ctrl + F )

            => The selected text has populated the search field

            • Make sure that none of the checkboxes are checked

            • Just check the Wrap around option

            • Select the Regular expression search mode

            • Click on the Find Next or Find All in Current Document button

            => It should matches, successively, the four lines of the new bab

            I supppse that’s your expected result !

            Best Regards,

            guy038

            FYI, My test sentence—which has no real meaning but displays all the accented French characters—can be translated into American - English as :

            It was there, near the forest, in a cabin that was in a state of utter chaos, that the grandfather took his flute and his walking stick out of his canoe
            
            dr ramaanandD 1 Reply Last reply Reply Quote 0
            • PeterJonesP Offline
              PeterJones @Troglo37
              last edited by

              @Troglo37 said:

              @Coises How and where do I put that?

              Find/Replace dialog, Find What. And set Search Mode = Regular Expression

              dr ramaanandD 1 Reply Last reply Reply Quote 2
              • dr ramaanandD Online
                dr ramaanand @PeterJones
                last edited by dr ramaanand

                He has to hit Ctrl+F on the keyboard or use the drop-down from the Menu bar on top to open that dialogue

                1 Reply Last reply Reply Quote 0
                • dr ramaanandD Online
                  dr ramaanand @guy038
                  last edited by

                  @guy038 said:

                  [[=C=]]‘[[=e=]][[=s=]][[=t=]] [[=l=]][[=à=]], [[=p=]][[=r=]][[=è=]][[=s=]] [[=d=]][[=e=]] [[=l=]][[=a=]] [[=f=]][[=o=]][[=r=]][[=ê=]][[=t=]], [[=d=]][[=a=]][[=n=]][[=s=]] [[=u=]][[=n=]] [[=g=]][[=î=]][[=t=]][[=e=]], [[=o=]][[=ù=]] [[=r=]][[=é=]][[=g=]][[=n=]][[=a=]][[=i=]][[=t=]] [[=u=]][[=n=]] [[=g=]][[=r=]][[=a=]][[=n=]][[=d=]] [[=c=]][[=a=]][[=p=]][[=h=]][[=a=]][[=r=]][[=n=]][[=a=]][[=ü=]][[=m=]], [[=q=]][[=u=]][[=e=]] [[=l=]]’[[=a=]][[=ï=]][[=e=]][[=u=]][[=l=]] [[=ô=]][[=t=]][[=a=]] [[=s=]][[=a=]] [[=f=]][[=l=]][[=û=]][[=t=]][[=e=]] [[=e=]][[=t=]] [[=s=]][[=o=]][[=n=]] [[=b=]][[=â=]][[=t=]][[=o=]][[=n=]] [[=d=]][[=e=]] [[=s=]][[=o=]][[=n=]] [[=c=]][[=a=]][[=n=]][[=o=]][[=ë=]]

                  That has accented alphabets but it should have unaccented alphabets to find all alphabets, including unaccented alphabets.

                  dr ramaanandD 1 Reply Last reply Reply Quote 0
                  • dr ramaanandD Online
                    dr ramaanand @dr ramaanand
                    last edited by dr ramaanand

                    @guy038 @peterjones Please change the title of this thread from, “Is There A Way To Ignore Letters With Accents When Searching?” to, “Is there a way to find both alphabets with and without accents when searching?” - right now, it gives the opposite meaning of the solution sought. An explanation for this type of solution can be found at https://community.notepad-plus-plus.org/topic/27449/search-accented-and-non-accented-characters-alike-with-one-simple-setting

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

                      Hello, @troglo37, @coises, @peterjones, @dr-ramaanand and All,

                      Préamble :

                      @troglo37, on demand of @dr-ramaanand, I changed your initial title :

                      Is There A Way To Ignore Letters With Accents When Searching?
                      

                      by this new title, which seems more acurrate :

                      Is there a way to find both alphabets, with and without accents, when searching?
                      

                      Thank you, @dr-ramaanand, for reminding me of this interesting post, which uses a more general, but more accurate, definition of accented characters !

                      Indeed, an accented character , let’s say the é character, may be described as :

                      • The character é LATIN SMALL LETTER E WITH ACUTE, of Unicode value 00E9

                      • The character e LATIN SMALL LETTER E, of Unicode value 0065, followed with the character  ́   COMBINING ACUTE ACCENT, of Unicode value 0301

                      Note that, in this second form, the letter e is the main character of an \X sequence and the accent(s), coming next, are the subsequent chars of this \X sequence !


                      So, the macro, described in my previous post, should be changed as :

                              <Macro name="Global Search" Ctrl="no" Alt="no" Shift="no" Key="0">
                                  <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
                                  <Action type="3" message="1601" wParam="0" lParam="0" sParam="(?=\X)(.)|(?!\X)." />
                                  <Action type="3" message="1625" wParam="0" lParam="2" sParam="" />
                                  <Action type="3" message="1602" wParam="0" lParam="0" sParam="(?1\(\?=[[=$1=]]\)\\X)" />
                                  <Action type="3" message="1702" wParam="0" lParam="640" sParam="" />
                                  <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
                              </Macro>
                      

                      And it means that :

                      • If the current character found is a single character OR the main character of a current \X sequence, it must be replaced with the string (?=[[=$1=]])\X, where $1 represents the current char

                      • If the current character found is an subsequent character of the current \X sequence, thus an accent, it must just be deleted as its main character has been previously taken in account


                      So, let’s consider the following text, pasted in a new tab :

                      C'est là, près de la forêt, dans un gîte, où régnait un grand capharnaüm, que l'aïeul ôta sa flûte et son bâton de son canoë
                      C'est là, près de la forêt, dans un gîte, où régnait un grand capharnaüm, que l'aïeul ôta sa flûte et son bâton de son canoë
                      

                      Note that, within the first line, the accented characters are single chars whereas, within the second line, the accentued chars are unaccented vowels followed with an accent character

                      If we apply our modified Global Search macro against the first line of this new tab, we get this regex :

                      (?=[[=C=]])\X(?=[[='=]])\X(?=[[=e=]])\X(?=[[=s=]])\X(?=[[=t=]])\X(?=[[= =]])\X(?=[[=l=]])\X(?=[[=à=]])\X(?=[[=,=]])\X(?=[[= =]])\X(?=[[=p=]])\X(?=[[=r=]])\X(?=[[=è=]])\X(?=[[=s=]])\X(?=[[= =]])\X(?=[[=d=]])\X(?=[[=e=]])\X(?=[[= =]])\X(?=[[=l=]])\X(?=[[=a=]])\X(?=[[= =]])\X(?=[[=f=]])\X(?=[[=o=]])\X(?=[[=r=]])\X(?=[[=ê=]])\X(?=[[=t=]])\X(?=[[=,=]])\X(?=[[= =]])\X(?=[[=d=]])\X(?=[[=a=]])\X(?=[[=n=]])\X(?=[[=s=]])\X(?=[[= =]])\X(?=[[=u=]])\X(?=[[=n=]])\X(?=[[= =]])\X(?=[[=g=]])\X(?=[[=î=]])\X(?=[[=t=]])\X(?=[[=e=]])\X(?=[[=,=]])\X(?=[[= =]])\X(?=[[=o=]])\X(?=[[=ù=]])\X(?=[[= =]])\X(?=[[=r=]])\X(?=[[=é=]])\X(?=[[=g=]])\X(?=[[=n=]])\X(?=[[=a=]])\X(?=[[=i=]])\X(?=[[=t=]])\X(?=[[= =]])\X(?=[[=u=]])\X(?=[[=n=]])\X(?=[[= =]])\X(?=[[=g=]])\X(?=[[=r=]])\X(?=[[=a=]])\X(?=[[=n=]])\X(?=[[=d=]])\X(?=[[= =]])\X(?=[[=c=]])\X(?=[[=a=]])\X(?=[[=p=]])\X(?=[[=h=]])\X(?=[[=a=]])\X(?=[[=r=]])\X(?=[[=n=]])\X(?=[[=a=]])\X(?=[[=ü=]])\X(?=[[=m=]])\X(?=[[=,=]])\X(?=[[= =]])\X(?=[[=q=]])\X(?=[[=u=]])\X(?=[[=e=]])\X(?=[[= =]])\X(?=[[=l=]])\X(?=[[='=]])\X(?=[[=a=]])\X(?=[[=ï=]])\X(?=[[=e=]])\X(?=[[=u=]])\X(?=[[=l=]])\X(?=[[= =]])\X(?=[[=ô=]])\X(?=[[=t=]])\X(?=[[=a=]])\X(?=[[= =]])\X(?=[[=s=]])\X(?=[[=a=]])\X(?=[[= =]])\X(?=[[=f=]])\X(?=[[=l=]])\X(?=[[=û=]])\X(?=[[=t=]])\X(?=[[=e=]])\X(?=[[= =]])\X(?=[[=e=]])\X(?=[[=t=]])\X(?=[[= =]])\X(?=[[=s=]])\X(?=[[=o=]])\X(?=[[=n=]])\X(?=[[= =]])\X(?=[[=b=]])\X(?=[[=â=]])\X(?=[[=t=]])\X(?=[[=o=]])\X(?=[[=n=]])\X(?=[[= =]])\X(?=[[=d=]])\X(?=[[=e=]])\X(?=[[= =]])\X(?=[[=s=]])\X(?=[[=o=]])\X(?=[[=n=]])\X(?=[[= =]])\X(?=[[=c=]])\X(?=[[=a=]])\X(?=[[=n=]])\X(?=[[=o=]])\X(?=[[=ë=]])\X
                      

                      Which does match the two lines of the new tab !

                      And if we apply our Global Search macro against the second line of this new tab, we get this regex :

                      (?=[[=C=]])\X(?=[[='=]])\X(?=[[=e=]])\X(?=[[=s=]])\X(?=[[=t=]])\X(?=[[= =]])\X(?=[[=l=]])\X(?=[[=a=]])\X(?=[[=,=]])\X(?=[[= =]])\X(?=[[=p=]])\X(?=[[=r=]])\X(?=[[=e=]])\X(?=[[=s=]])\X(?=[[= =]])\X(?=[[=d=]])\X(?=[[=e=]])\X(?=[[= =]])\X(?=[[=l=]])\X(?=[[=a=]])\X(?=[[= =]])\X(?=[[=f=]])\X(?=[[=o=]])\X(?=[[=r=]])\X(?=[[=e=]])\X(?=[[=t=]])\X(?=[[=,=]])\X(?=[[= =]])\X(?=[[=d=]])\X(?=[[=a=]])\X(?=[[=n=]])\X(?=[[=s=]])\X(?=[[= =]])\X(?=[[=u=]])\X(?=[[=n=]])\X(?=[[= =]])\X(?=[[=g=]])\X(?=[[=i=]])\X(?=[[=t=]])\X(?=[[=e=]])\X(?=[[=,=]])\X(?=[[= =]])\X(?=[[=o=]])\X(?=[[=ù=]])\X(?=[[= =]])\X(?=[[=r=]])\X(?=[[=e=]])\X(?=[[=g=]])\X(?=[[=n=]])\X(?=[[=a=]])\X(?=[[=i=]])\X(?=[[=t=]])\X(?=[[= =]])\X(?=[[=u=]])\X(?=[[=n=]])\X(?=[[= =]])\X(?=[[=g=]])\X(?=[[=r=]])\X(?=[[=a=]])\X(?=[[=n=]])\X(?=[[=d=]])\X(?=[[= =]])\X(?=[[=c=]])\X(?=[[=a=]])\X(?=[[=p=]])\X(?=[[=h=]])\X(?=[[=a=]])\X(?=[[=r=]])\X(?=[[=n=]])\X(?=[[=a=]])\X(?=[[=u=]])\X(?=[[=m=]])\X(?=[[=,=]])\X(?=[[= =]])\X(?=[[=q=]])\X(?=[[=u=]])\X(?=[[=e=]])\X(?=[[= =]])\X(?=[[=l=]])\X(?=[[='=]])\X(?=[[=a=]])\X(?=[[=i=]])\X(?=[[=e=]])\X(?=[[=u=]])\X(?=[[=l=]])\X(?=[[= =]])\X(?=[[=o=]])\X(?=[[=t=]])\X(?=[[=a=]])\X(?=[[= =]])\X(?=[[=s=]])\X(?=[[=a=]])\X(?=[[= =]])\X(?=[[=f=]])\X(?=[[=l=]])\X(?=[[=u=]])\X(?=[[=t=]])\X(?=[[=e=]])\X(?=[[= =]])\X(?=[[=e=]])\X(?=[[=t=]])\X(?=[[= =]])\X(?=[[=s=]])\X(?=[[=o=]])\X(?=[[=n=]])\X(?=[[= =]])\X(?=[[=b=]])\X(?=[[=a=]])\X(?=[[=t=]])\X(?=[[=o=]])\X(?=[[=n=]])\X(?=[[= =]])\X(?=[[=d=]])\X(?=[[=e=]])\X(?=[[= =]])\X(?=[[=s=]])\X(?=[[=o=]])\X(?=[[=n=]])\X(?=[[= =]])\X(?=[[=c=]])\X(?=[[=a=]])\X(?=[[=n=]])\X(?=[[=o=]])\X(?=[[=e=]])\X
                      

                      Which does match, also, the two lines of the new tab !


                      In conclusion, this method allows you to search for a stream selection of characters, regardless of the syntax of the accented characters within that selection !

                      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