Problem with converting lowercase to uppercase
-
@Pan-Jan said in Problem with converting lowercase to uppercase:
I’m using a different editor
This forum isn’t a generic regex help site. If you are using a different editor, ask in their forum, or find a regex help site (generic, or specific to the regex engine used by your editor).
-
Hello, @pan-jan and All,
Try this regex S/R :
SEARCH
(?i)\bMc([[:alpha:]])REPLACE
Mc\u$1which changes any form, as below :
mcDonalds McDonalds mCDonalds MCDonalds mcdonalds Mcdonalds mCdonalds MCdonaldswith 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 singleuppercaseorlowercaseletter -
In replacement, the
\usyntax rewrites the next letter, stored in group1, inuppercase
BR
guy038
-
-
@guy038 said in Problem with converting lowercase to uppercase:
the \u syntax
just the
\u
syntax doesn’t work
-
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)fooREPLACE
\ubarchanges the word foo, with this exact case, by Bar
And :
SEARCH
(?-i)(foo|bar)REPLACE
\u$1would change the words
fooandbar, with this exact case, by the wordsFooandBarBest Regards,
guy038
-
maybe you missed @PeterJones comment and OPs info?
I’m using a different editor, and RegEx doesn’t use \u or \l there
-
Hi @ekopalyse,
Ah… OK. So, what’s he waiting for to switch to Notepad++ ;-)))
BR
guy038
-
@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 ++. -
Hi, @pan-jan,
If so, why don’t you join the
Akelpadcommunity and find out a solution, from within this software, or, may be, ask theAkelpad’s author to improve the regex engine ?BR
guy038
-
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. -
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
\u0025for 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.
-
@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?
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