I've been looking for "get everything but" regex questions, but I couldn't make it work for my case.
I was trying to get everything except a closing comment */
.
I have this expression that gets the me declaration of javascript functions:
/(\b(f|F)unction(.*?)\((.*?)\)\s*\{)/g
The only problem I found with it at the moment is that it also gets me things such as:
function to do whatever */ function demo (el, hop) {
Instead of
function demo (el, hop) {
When having this function declaration with a comment containing the word function
.
/** * recursive function to do whatever */ function demo (el, hop) { /*whatever*/ }
This is what I tried so far with no result:
/(\b(f|F)unction^((?!\*\/).)*?\((.*?)\)\s*\{)/g
Which is basically using what recommending in this post:
^((?!hede).)*$ //recommended
^((?!\*\/).)*? //mine
What am I doing wrong?