Problem with converting lowercase to uppercase
-
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?