【发布时间】:2018-11-16 20:56:47
【问题描述】:
我想从这个文本中用 CamelCase 搜索词来生成。 我不知道这是否仅适用于 RegEx。但我已经很接近了。 我在脚本语言 AutoHotkey (https://autohotkey.com/docs/misc/RegEx-QuickRef.htm) 中使用它。
数据:推荐用于未来的 AutoHotkeyReleases。
正则表达式:(((\b[^A-Z\s]*)?([A-Z][a-z]+)|([\W_-]?[a-z]+))) (https://regex101.com/r/NgRmXZ/2)
预期组:
reCommended
re
Commended
for
future
Auto
Hotkey
AutoHotkey
HotkeyReleases
Releases
AutoHotkeyReleases.
我也试过了,但对我不起作用:
(?=\p{Lu}\p{Ll})|(?<=\p{Ll})(?=\p{Lu}) 来自Splitting CamelCase with regex
(([a-z]*)(?<=[a-z])((?:[A-Z])[a-z]+))https://regex101.com/r/NgRmXZ/3
(?<=[a-z])([A-Z])|(?<=[A-Z])([A-Z][a-z])https://regex101.com/r/NgRmXZ/4
((?<!^)([A-Z][a-z]+|(?<=[a-z])[A-Z][a-z]+))https://regex101.com/r/B5vXaZ/1
我已经开始在这里实现我的原型了: https://gist.github.com/sl5net/ba5aef19f44fe68204ccb6c96e7c96e0
【问题讨论】:
标签: regex autohotkey