Regex Not Capturing Words with Mixed Case in C# - guide with Case Sensitivity
I'm stuck on something that should probably be simple. I'm having trouble with a regex pattern in C# that should match words with mixed case letters, but it seems to be ignoring certain combinations. For example, I want to capture words like 'HelloWorld', 'testString', and 'RegEx101', but my current pattern only matches lowercase and uppercase words separately. I tried the following regex pattern: ```csharp string pattern = "[A-Z][a-zA-Z]*"; ``` This pattern matches words that start with an uppercase letter followed by any combination of lowercase and uppercase letters, but it fails to capture camel case implementations. When I run it against the string: ```csharp string input = "Here are some examples: HelloWorld, testString, and RegEx101."; ``` I get the following matches: - HelloWorld - testString - RegEx101 (which I expected to match, but it doesn't) I also attempted to modify the regex to: ```csharp string pattern = "[A-Z][a-zA-Z]*[a-z]*"; ``` But this still doesn't yield 'RegEx101' as a match, and I end up with the same results. I noticed that when I test it, the output seems to only capture the first portion of mixed-case words. I am using .NET 5.0, and I believe I need to address the case sensitivity scenario better. Is there a way to tweak the regex to capture any mixed case word correctly? Any advice would be appreciated! How would you solve this? Am I approaching this the right way? For context: I'm using C# on Linux.