Java常用模式,第一个字母小写,strict lower camel case
[a-z]+((\d)|([A-Z0-9][a-z0-9]+))*([A-Z])?
可以匹配以下字符串:
xmlHttpRequest
newCustomerId
innerStopwatch
supportsIpv6OnIos
youTubeImporter
youtubeImporter
affine3D
Python 中需要对方法加一根或两根下划线,可以修改成:
_{0,2}[a-z]+((\d)|([A-Z0-9][a-z0-9]+))*([A-Z])?
可以匹配:
getCodeReadExamples
_getCodeReadExamples
__getCodeReadExamples
蛇形命名(允许下划线)
_{0,2}[a-z][a-z0-9_]*
其他请参考
https://newbedev.com/regex-for-pascalcased-words-aka-camelcased-with-leading-uppercase-letter