You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using balanced-match to isolate the body of a function (all between brackets)
So, I assume during my test that a function is begining by the same pattern (scope function name params {) and finishing by a bracket (with positive lookahead to see if the next caracters are a new function)
Here is my two regex :
firstRegex : /(override)?\s?(public|private|protected)\s(?:function)\s(get)?\s?(\w*)\s?\((.*)\)\s?:?\s?(\w*)\s*{/
secondRegex : /}(\s)*(?=override|public|private|protected|(}\s*}))/
It's working fine except for the last function who is not followed by a new function but by two brackets (for the end of the class and the end of package)
Hi,
I'm using balanced-match to isolate the body of a function (all between brackets)
So, I assume during my test that a function is begining by the same pattern (scope function name params {) and finishing by a bracket (with positive lookahead to see if the next caracters are a new function)
Here is my two regex :
firstRegex :
/(override)?\s?(public|private|protected)\s(?:function)\s(get)?\s?(\w*)\s?\((.*)\)\s?:?\s?(\w*)\s*{/
secondRegex :
/}(\s)*(?=override|public|private|protected|(}\s*}))/
It's working fine except for the last function who is not followed by a new function but by two brackets (for the end of the class and the end of package)
I have tested my two regex on regex101 and it's working fine (https://regex101.com/r/A7jQDr/1) but when I test with balanced-match it didn't match the same way regex101 does.
Here is my test on RunKit : https://runkit.com/59c0dc7528f14c00126b4314/59c0dc7662f5730012fd1760
As you can see, the match.post contains a extra bracket ..
If someone can tell me what's wrong.
The text was updated successfully, but these errors were encountered: