Community
    • Login

    Problem with converting lowercase to uppercase

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    12 Posts 5 Posters 1.4k 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.
    • guy038G Offline
      guy038
      last edited by guy038

      Hello, @pan-jan and All,

      Try this regex S/R :

      SEARCH (?i)\bMc([[:alpha:]])

      REPLACE Mc\u$1

      which changes any form, as below :

      mcDonalds
      McDonalds
      mCDonalds
      MCDonalds
      mcdonalds
      Mcdonalds
      mCdonalds
      MCdonalds
      

      with the unique good syntax :

      McDonalds
      

      Notes :

      • The (?i) in-line modifier carries the search in an insensitive way

      • The [[:alpha:]] POSIX class range represents any single uppercase or lowercase letter

      • In replacement, the \u syntax rewrites the next letter, stored in group 1, in uppercase

      BR

      guy038

      1 Reply Last reply Reply Quote 0
      • Thomas 2020T Offline
        Thomas 2020
        last edited by

        @guy038 said in Problem with converting lowercase to uppercase:

        the \u syntax

        just the

        \u

        syntax doesn’t work

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

          Hello @pan-jan and All,

          I’m really sorry but the regex syntax \u, in replacement, does do the job ! That is to say it capitalizes the first letter of the following string or group !

          For instance :

          SEARCH (?-i)foo

          REPLACE \ubar

          changes the word foo, with this exact case, by Bar

          And :

          SEARCH (?-i)(foo|bar)

          REPLACE \u$1

          would change the words foo and bar , with this exact case, by the words Foo and Bar

          Best Regards,

          guy038

          EkopalypseE 1 Reply Last reply Reply Quote 0
          • EkopalypseE Offline
            Ekopalypse @guy038
            last edited by Ekopalypse

            @guy038

            maybe you missed @PeterJones comment and OPs info?

            I’m using a different editor, and RegEx doesn’t use \u or \l there

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

              Hi @ekopalyse,

              Ah… OK. So, what’s he waiting for to switch to Notepad++ ;-)))

              BR

              guy038

              1 Reply Last reply Reply Quote 1
              • Thomas 2020T Offline
                Thomas 2020
                last edited by

                @guy038 said in Problem with converting lowercase to uppercase:

                So, what’s he waiting for to switch to Notepad++

                Thank you but…
                AkelPad is much better than Notepad ++.

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

                  Hi, @pan-jan,

                  If so, why don’t you join the Akelpad community and find out a solution, from within this software, or, may be, ask the Akelpad’s author to improve the regex engine ?

                  BR

                  guy038

                  1 Reply Last reply Reply Quote 2
                  • Thomas 2020T Offline
                    Thomas 2020
                    last edited by Thomas 2020

                    I asked before.
                    No response means nothing can be done.

                    I see there are some good RegEx specialists here
                    and I’m trying to solve the problem here.

                    1 Reply Last reply Reply Quote 0
                    • mkupperM Offline
                      mkupper
                      last edited by mkupper

                      Implementation of regex varies from one application to the next.

                      It’s a guess based on the OP’s results but it seems that \u in the OP’s editor is the lead-in for Unicode related stuff such as \u0025 for a percent (%) sign. The OP’s examples have \xFFFF characters in them.

                      Fiddling with people’s names seems dangerous as there are people who have Mc… style surnames where the third character is not upper-case. If there is a requirement to make the names a consistent case then convert everything to upper case.

                      I think we are in https://community.notepad-plus-plus.org/topic/15958/faq-desk-you-ve-asked-your-question-in-the-wrong-place territory.

                      1 Reply Last reply Reply Quote 2
                      • Thomas 2020T Offline
                        Thomas 2020
                        last edited by

                        @mkupper said in Problem with converting lowercase to uppercase:

                        as there are people who have Mc… style surnames where the third character is not upper-case

                        e.g?

                        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