Call me old fashioned, but I would just use standard emacs regexp search
foo\s-*\(//[^
]
\s-*\)*bar
That’s off the top of my head. I will test it in emacs tomorrow - I don’t have emacs on my iPhone :-(.
I use isearch-forward-re to the exclusion of all else. Standard key binding C-M-s. You might prefer re-search-forward.
Commentary
\s- → character class whitespace
\s-* → 0 to infinite whitespace
\(…\) → group
Within the group:
// → your comment
[^] (with an actual line break instead of  — type C-q C-j) → any character that is not a newline
And thus
//[^
]*
\s-*
→ comment to end of line,
followed by a newline and whitespace at beginning of line.
All of that in a \(…\) group, *’ed to repeat 0 to infinite times.
The funkiest part is the newlines in the regexp. I get them by typing C-q (quote-char) followed by C-j, since C-j is newline.
If all of the above is in an elisp string, then the backslashes will have to be doubled, and you can use \n for a newline.
In the really old days I might have typed [ blank tab ]* - which is illegible. Now I usually remember to type \s-*. But note that syntax class tables can vary.
Modern emacs uses character classes like [:blank:] for tab and space, or [:space:] for any whitespace including tab and space and newline.
So my original regexp might be more readable as
foo[[:space:]]*\(//\([[:blank:]]*[^[:space:]]*\)*\)*[[:space:]]*bar
The trick here is that I don’t know of any easily readable version of “any character except newline”, so instead I do a group of ( any blanks followed by any non-spaces ), which is equivalent when starred,
Again, untested.
foo\s-*\(//[^
]
\s-*\)*bar