I have below string pattern
step_User_Save_Action_Details
I want to make sure a capital letter follows after each underscore symbol.
Example:
step_User_Save_Action_Details - Should return true
step_User_save_Action_Details - Should return false
Tried with below pattern but seems to not working...
step[_[A-Z]*]
You can use this regex:
\bstep(?:_[A-Z][A-Za-z]*)+\b
(?:_[AZ][A-Za-z]*)
makes sure that there is an uppercase letter right after underscore. +
quantifier after this non-capturing group will let it match multiple of these underscores in the word.
\\b
is there to enforce word boundary before step
and after last component.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.