开发者

Need help with a regex pattern for matching part of word until next uppercase letter

开发者 https://www.devze.com 2023-03-17 04:25 出处:网络
I need part of a word. For e开发者_如何学运维xample if we have \"CheckResults\" I just want to get \"Check\". Can someone help me with regex for this?\\b[A-Z][a-z]+

I need part of a word. For e开发者_如何学运维xample if we have "CheckResults" I just want to get "Check". Can someone help me with regex for this?


\b[A-Z][a-z]+

Finds the begining of a word and then matches until the end of the word or a capital letter. If the word won't always be capitalized, use this:

\b[A-Z]?[a-z]+
0

精彩评论

暂无评论...
验证码 换一张
取 消