Could anyone tell me how I might be able to fix the issue in the following regex sample?
https://regex101.com/r/t9Wxs2/1
It is matching the initial method call when I just want it to match the ( ) of the fat arrow expression. Regex is not my strong suit unfortunately.
Regex assistance
Forum rules
Discuss Autohotkey related topics here. Not a place to share code.
Discuss Autohotkey related topics here. Not a place to share code.
Re: Regex assistance
I think you just want \K, so, the info before the \K is used for searching, but not output in the result.
Also, you could use [^(] instead of ., to select consecutive characters, but exclude open parentheses.
Also, you could use [^(] instead of ., to select consecutive characters, but exclude open parentheses.
Code: Select all
before/after/after:
\b\w+\((.*)\)(?=\s*=>)
\b\w+\K\((.*)\)(?=\s*=>)
\(([^(]*)\)(?=\s*=>)
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Regex assistance
@jeeswg Thanks, that does help. My conflict now is that it matches too soon if the function call has a string with a close parenthesis in it or a fat arrow function... Seems like I can't get the right combination of commands here.
Notice how the last line isn't properly matching till the end.
https://regex101.com/r/t9Wxs2/2
Notice how the last line isn't properly matching till the end.
https://regex101.com/r/t9Wxs2/2
Re: Regex assistance
Hmm, there's a problem because there's a literal parenthesis inside a string.
At that point I might consider properly parsing the string, i.e. identifying parentheses, commas, quotes (the starts/ends of strings) etc. Which I do here:
DllCall converter/cleaner (e.g. x32 to x64/x32 two-way compatible) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=31365
Btw what is your overall aim? Cheers.
At that point I might consider properly parsing the string, i.e. identifying parentheses, commas, quotes (the starts/ends of strings) etc. Which I do here:
DllCall converter/cleaner (e.g. x32 to x64/x32 two-way compatible) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=31365
Btw what is your overall aim? Cheers.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Regex assistance
Playing creating visual studio code extensions for AHK. So syntax highlighting is the start. Then maybe symbol definitions.
Return to “General Discussion”
Who is online
Users browsing this forum: No registered users and 31 guests