I am trying to come up with a regex for both Upper and lower Camel case.
Here is what I tried
(([A-Z][a-z0-9]*){2,}|([a-z][A-Z0-9]*){2,})
Trying to match Upper camel case with this - ([A-Z][a-z0-9]){2,} but it is matching other combinations as well. Similar is the case with the second part - ([a-z][A-Z0-9]){2,})
This would match upper and lower camel case phrases containing at least one upper case in the word.
Upper Camel Case
[A-Z][a-z0-9]*[A-Z0-9][a-z0-9]+[A-Za-z0-9]*
example:HelloWorld, AQuickBrownFox
Lower Camel Case
[a-z]+[A-Z0-9][a-z0-9]+[A-Za-z0-9]*
example: helloWorld, aQuickBrownFox
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With