您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

使用php preg_match(正则表达式)将camelCase单词拆分为单词

使用php preg_match(正则表达式)将camelCase单词拆分为单词

您还可以preg_match_all用作:

preg_match_all('/((?:^|[A-Z])[a-z]+)/',$str,$matches);

说明:

(        - Start of capturing parenthesis.
 (?:     - Start of non-capturing parenthesis.
  ^      - Start anchor.
  |      - Alternation.
  [A-Z]  - Any one capital letter.
 )       - End of non-capturing parenthesis.
 [a-z]+  - one ore more lowercase letter.
)        - End of capturing parenthesis.
php 2022/1/1 18:17:13 有522人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶