generate search words from text with CamelCase by using regEx
I want from this text with CamelCase search words to generate.
I do not know if that's possible only with RegEx. but I'm already close.
I use it in the scripting language AutoHotkey (https://autohotkey.com/docs/misc/RegEx-QuickRef.htm) .
data: reCommended for future AutoHotkeyReleases.
regEx: (((b[^A-Zs]*)?([A-Z][a-z]+)|([W_-]?[a-z]+))) ( https://regex101.com/r/NgRmXZ/2 )
expected Groups:
reCommended
re
Commended
for
future
Auto
Hotkey
AutoHotkey
HotkeyReleases
Releases
AutoHotkeyReleases.
i also tried, but not works for me:
(?=p{Lu}p{Ll})|(?<=p{Ll})(?=p{Lu}) from 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
I have started to implement my prototyp already here:
https://gist.github.com/sl5net/ba5aef19f44fe68204ccb6c96e7c96e0
regex autohotkey
add a comment |
I want from this text with CamelCase search words to generate.
I do not know if that's possible only with RegEx. but I'm already close.
I use it in the scripting language AutoHotkey (https://autohotkey.com/docs/misc/RegEx-QuickRef.htm) .
data: reCommended for future AutoHotkeyReleases.
regEx: (((b[^A-Zs]*)?([A-Z][a-z]+)|([W_-]?[a-z]+))) ( https://regex101.com/r/NgRmXZ/2 )
expected Groups:
reCommended
re
Commended
for
future
Auto
Hotkey
AutoHotkey
HotkeyReleases
Releases
AutoHotkeyReleases.
i also tried, but not works for me:
(?=p{Lu}p{Ll})|(?<=p{Ll})(?=p{Lu}) from 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
I have started to implement my prototyp already here:
https://gist.github.com/sl5net/ba5aef19f44fe68204ccb6c96e7c96e0
regex autohotkey
add a comment |
I want from this text with CamelCase search words to generate.
I do not know if that's possible only with RegEx. but I'm already close.
I use it in the scripting language AutoHotkey (https://autohotkey.com/docs/misc/RegEx-QuickRef.htm) .
data: reCommended for future AutoHotkeyReleases.
regEx: (((b[^A-Zs]*)?([A-Z][a-z]+)|([W_-]?[a-z]+))) ( https://regex101.com/r/NgRmXZ/2 )
expected Groups:
reCommended
re
Commended
for
future
Auto
Hotkey
AutoHotkey
HotkeyReleases
Releases
AutoHotkeyReleases.
i also tried, but not works for me:
(?=p{Lu}p{Ll})|(?<=p{Ll})(?=p{Lu}) from 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
I have started to implement my prototyp already here:
https://gist.github.com/sl5net/ba5aef19f44fe68204ccb6c96e7c96e0
regex autohotkey
I want from this text with CamelCase search words to generate.
I do not know if that's possible only with RegEx. but I'm already close.
I use it in the scripting language AutoHotkey (https://autohotkey.com/docs/misc/RegEx-QuickRef.htm) .
data: reCommended for future AutoHotkeyReleases.
regEx: (((b[^A-Zs]*)?([A-Z][a-z]+)|([W_-]?[a-z]+))) ( https://regex101.com/r/NgRmXZ/2 )
expected Groups:
reCommended
re
Commended
for
future
Auto
Hotkey
AutoHotkey
HotkeyReleases
Releases
AutoHotkeyReleases.
i also tried, but not works for me:
(?=p{Lu}p{Ll})|(?<=p{Ll})(?=p{Lu}) from 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
I have started to implement my prototyp already here:
https://gist.github.com/sl5net/ba5aef19f44fe68204ccb6c96e7c96e0
regex autohotkey
regex autohotkey
asked Nov 16 '18 at 20:56
SL5netSL5net
3561415
3561415
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I have made a regex that almost satisfies your need. However, I'm missing one combination. I don't think, it's possible, because it would require parantheses to overlap, the 'Hotkey' would have to be part of two different overlapping Groups.
Well, here's the regex:
/b((w+?(?=[A-Z]|b))([A-Z][a-z]*)?)([A-Z][a-z]*)?/g
It starts by a Word boundary, then creates 2 Groups, Group 2 matches any Word character one or more times (ungreedy) until a look ahead for a Capital letter OR a Word boundary is reached.
Group 3 will match a Capital letter followed by zero or more lowercase letters. That is optional.
Group 1 combines Group 2 and Group 3.
Finally Group 4 will match a Capital letter followed by zero or more lowercase letters. That is optional.
As mentioned, I don't think its possible to create a Group, that combines Group 3 and Group 4, since they overlap. Other than that, this should Work, as you want.
1
it works also in autohotkey specific regEx. i implemeted it here: github.com/sl5net/global-IntelliSense-everywhere-Nightly-Build/…
– SL5net
Nov 18 '18 at 10:09
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53345266%2fgenerate-search-words-from-text-with-camelcase-by-using-regex%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I have made a regex that almost satisfies your need. However, I'm missing one combination. I don't think, it's possible, because it would require parantheses to overlap, the 'Hotkey' would have to be part of two different overlapping Groups.
Well, here's the regex:
/b((w+?(?=[A-Z]|b))([A-Z][a-z]*)?)([A-Z][a-z]*)?/g
It starts by a Word boundary, then creates 2 Groups, Group 2 matches any Word character one or more times (ungreedy) until a look ahead for a Capital letter OR a Word boundary is reached.
Group 3 will match a Capital letter followed by zero or more lowercase letters. That is optional.
Group 1 combines Group 2 and Group 3.
Finally Group 4 will match a Capital letter followed by zero or more lowercase letters. That is optional.
As mentioned, I don't think its possible to create a Group, that combines Group 3 and Group 4, since they overlap. Other than that, this should Work, as you want.
1
it works also in autohotkey specific regEx. i implemeted it here: github.com/sl5net/global-IntelliSense-everywhere-Nightly-Build/…
– SL5net
Nov 18 '18 at 10:09
add a comment |
I have made a regex that almost satisfies your need. However, I'm missing one combination. I don't think, it's possible, because it would require parantheses to overlap, the 'Hotkey' would have to be part of two different overlapping Groups.
Well, here's the regex:
/b((w+?(?=[A-Z]|b))([A-Z][a-z]*)?)([A-Z][a-z]*)?/g
It starts by a Word boundary, then creates 2 Groups, Group 2 matches any Word character one or more times (ungreedy) until a look ahead for a Capital letter OR a Word boundary is reached.
Group 3 will match a Capital letter followed by zero or more lowercase letters. That is optional.
Group 1 combines Group 2 and Group 3.
Finally Group 4 will match a Capital letter followed by zero or more lowercase letters. That is optional.
As mentioned, I don't think its possible to create a Group, that combines Group 3 and Group 4, since they overlap. Other than that, this should Work, as you want.
1
it works also in autohotkey specific regEx. i implemeted it here: github.com/sl5net/global-IntelliSense-everywhere-Nightly-Build/…
– SL5net
Nov 18 '18 at 10:09
add a comment |
I have made a regex that almost satisfies your need. However, I'm missing one combination. I don't think, it's possible, because it would require parantheses to overlap, the 'Hotkey' would have to be part of two different overlapping Groups.
Well, here's the regex:
/b((w+?(?=[A-Z]|b))([A-Z][a-z]*)?)([A-Z][a-z]*)?/g
It starts by a Word boundary, then creates 2 Groups, Group 2 matches any Word character one or more times (ungreedy) until a look ahead for a Capital letter OR a Word boundary is reached.
Group 3 will match a Capital letter followed by zero or more lowercase letters. That is optional.
Group 1 combines Group 2 and Group 3.
Finally Group 4 will match a Capital letter followed by zero or more lowercase letters. That is optional.
As mentioned, I don't think its possible to create a Group, that combines Group 3 and Group 4, since they overlap. Other than that, this should Work, as you want.
I have made a regex that almost satisfies your need. However, I'm missing one combination. I don't think, it's possible, because it would require parantheses to overlap, the 'Hotkey' would have to be part of two different overlapping Groups.
Well, here's the regex:
/b((w+?(?=[A-Z]|b))([A-Z][a-z]*)?)([A-Z][a-z]*)?/g
It starts by a Word boundary, then creates 2 Groups, Group 2 matches any Word character one or more times (ungreedy) until a look ahead for a Capital letter OR a Word boundary is reached.
Group 3 will match a Capital letter followed by zero or more lowercase letters. That is optional.
Group 1 combines Group 2 and Group 3.
Finally Group 4 will match a Capital letter followed by zero or more lowercase letters. That is optional.
As mentioned, I don't think its possible to create a Group, that combines Group 3 and Group 4, since they overlap. Other than that, this should Work, as you want.
answered Nov 16 '18 at 23:54
Poul BakPoul Bak
5,46831232
5,46831232
1
it works also in autohotkey specific regEx. i implemeted it here: github.com/sl5net/global-IntelliSense-everywhere-Nightly-Build/…
– SL5net
Nov 18 '18 at 10:09
add a comment |
1
it works also in autohotkey specific regEx. i implemeted it here: github.com/sl5net/global-IntelliSense-everywhere-Nightly-Build/…
– SL5net
Nov 18 '18 at 10:09
1
1
it works also in autohotkey specific regEx. i implemeted it here: github.com/sl5net/global-IntelliSense-everywhere-Nightly-Build/…
– SL5net
Nov 18 '18 at 10:09
it works also in autohotkey specific regEx. i implemeted it here: github.com/sl5net/global-IntelliSense-everywhere-Nightly-Build/…
– SL5net
Nov 18 '18 at 10:09
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53345266%2fgenerate-search-words-from-text-with-camelcase-by-using-regex%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown