Regular Expression to Change Uppercase Text to Lowercase
-
Can someone assist with a regular expression that will replace and capitalize the first character in a text characters to lowercase For example PETER Before Peter After JohN Before John After paul Before Paul After The following Regex will locate the Uppercase characters [A-Z] But I don't know how to replace them by turning the first character to Uppercase. Thanks
-
Can someone assist with a regular expression that will replace and capitalize the first character in a text characters to lowercase For example PETER Before Peter After JohN Before John After paul Before Paul After The following Regex will locate the Uppercase characters [A-Z] But I don't know how to replace them by turning the first character to Uppercase. Thanks
-
Can someone assist with a regular expression that will replace and capitalize the first character in a text characters to lowercase For example PETER Before Peter After JohN Before John After paul Before Paul After The following Regex will locate the Uppercase characters [A-Z] But I don't know how to replace them by turning the first character to Uppercase. Thanks
In C# (for example) there is no "proper case": one changes to "lower case", then uses "title case". [TextInfo.ToTitleCase(String) Method (System.Globalization) | Microsoft Docs](https://docs.microsoft.com/en-us/dotnet/api/system.globalization.textinfo.totitlecase?view=net-5.0)
Quote:
Converts the specified string to title case (except for words that are entirely in uppercase, which are considered to be acronyms).
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
-
You are probably better off using one of the many methods available with the String type. But since you have not identified which language you are using, that is something of a guess.
Hi, Thanks for reaching out. Sorry for not mentioning the language. The language is JAVA 8
-
In C# (for example) there is no "proper case": one changes to "lower case", then uses "title case". [TextInfo.ToTitleCase(String) Method (System.Globalization) | Microsoft Docs](https://docs.microsoft.com/en-us/dotnet/api/system.globalization.textinfo.totitlecase?view=net-5.0)
Quote:
Converts the specified string to title case (except for words that are entirely in uppercase, which are considered to be acronyms).
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
Thanks getting in touch. I'm using Java 8 Are you able help?
-
Hi, Thanks for reaching out. Sorry for not mentioning the language. The language is JAVA 8
-
Hi Richard, Thanks for reaching out. And thanks for the link. Unfortunately, I'm extremely new to Regex so unfortunately I wouldn't know where to look in the link String (Java Platform SE 7 )[^] I thought this was a pretty easy question for someone help with an answer to?
-
Hi Richard, Thanks for reaching out. And thanks for the link. Unfortunately, I'm extremely new to Regex so unfortunately I wouldn't know where to look in the link String (Java Platform SE 7 )[^] I thought this was a pretty easy question for someone help with an answer to?
-
The String class has nothing to do with Regexes. You use it to quickly convert all characters to lower case. You can then find some method to capitalise the first letter of each word.
Hi Richard, Sorry to be pain, but could please provide an example
-
Hi Richard, Sorry to be pain, but could please provide an example
-
I have a better idea. Think about what you are trying to do and work out which methods are likely to help you. You will learn far more by trying things yourself.
ok, I will think of something. I will post it. Hopefully, you'll let me know if I'm on the right track
-
I have a better idea. Think about what you are trying to do and work out which methods are likely to help you. You will learn far more by trying things yourself.
I'm never going to figure it out! Can I get some hints on a solution?
-
I have a better idea. Think about what you are trying to do and work out which methods are likely to help you. You will learn far more by trying things yourself.
So, this is my attempt I tried the following regex in Java 8, (?i)(Helló) (Wórld) which matches HeLlÓ WóRlD the replacement string \U$1 \L$2 should become HELLÓ wórld, but it doesn't work. Can someone please help me???