You are not logged in.
Pages: 1
I hate regex. Well, it hates me. So it seems mutual.
Tried this
Expression: \bMc(\l)
Replace: Mc\U($1)
Tought it would upper all the Scottish names (like McDonalds, McCoy, McScott.....) but it didnt. Probably not even close. Cause I dont know what I do lol.
Anyone know the proper regex for this?
Also, for MacIntosh, LeMans etc. But I can adapt that myself. I think.
Offline
You are very close.
FROM:
Mcdonalds, Mccoy, Mcscott.
TO:
McDonalds, McCoy, McScott.
TRY:
https://www.den4b.com/wiki/ReNamer:Rules:RegEx
1) Regular Expressions: Replace expression "\bMc(.)" with "Mc\U$1" (case sensitive) (skip extension)
Explanations:
https://www.den4b.com/wiki/ReNamer:Regular_Expressions
\b >> word boundary
Mc >> literal text
. >>> one sign of any character (the symbol is just a dot)
() >> Subexpression, here for to store for later reuse
\U >> Convert all following characters to uppercase.
$1 >> backreference what was matched in subexpression
Read the *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)
Offline
I take solace in the fact that I have various other skills. Even if my incapability in regex makes me sad.
thanks mate, works perfectly!
Offline
So, Macy Gray becomes MacY Gray lol. Do I just add this as an exception (e.g. revert it back to Macy at the end of all actions) or is there a more elegant way to eliminate those - probably rare - instances?
Offline
Tought it would upper all the Scottish names (like McDonalds, McCoy, McScott.....)
So, Macy Gray becomes MacY Gray
FROM:
Macy Gray is great Machurike macher machu macy machurry.
TO:
Macy Gray is great MacHurike MacHer machu macy MacHurry.
TRY:
https://www.den4b.com/wiki/ReNamer:Rules:RegEx
1) Regular Expressions: Replace expression "\bMac(.{3,})" with "Mac\u$1" (case sensitive) (skip extension)
\bMac(.{3,}) >>> for to match "Mac" plus at least 3 of any signs.
In the replacement use then lower case u instead of upper case U.
https://www.den4b.com/wiki/ReNamer:Regular_Expressions
\U >> Convert all characters to uppercase.
\u >> Convert only the first character to uppercase.
Read the *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)
Offline
More brilliance! Thank you very much Stefan!
Offline
And in a quiet minute I’ll try to understand how and why it works :-)
Offline
Pages: 1