The problem here with your UltraEdit style regex is that you are not thinking in the same way as the search string parser does. You think here following:
Search in the file for a line containing the string "RecordSet.Open" OR "Connection.Execute". If found, check if the line does not start with a '. If this condition is also TRUE - string found.
What I think, how the search string parser does:
Find the start of a line. Check if is not a ' - OK. The parser is now at column 2.
* means match any number of occurrences of any character except newline.
Well, start matching at current position (column 2) and stop at - that's the problem.
Where should the * matching stop now? Normally if the following string is found or the line termination. I think the * search matching algorithm is designed for stop when next simple string is found. The string following the * can be also only a single character (1 byte string).
But in your regular expression there is no simple string after the *. There is again a regular expression which can match different strings. The search engines solves this conflict by simple use only the first string of the OR expression for the stop condition of the * match. And that's the reason why it fails.
Same problem also with something like "A*[~BC]". This also does not work. The * match algorithm needs a simple string or character as stop condition.
How to solve this * matching stop condition problem. Well, I have already written a regular expression which is better:
%[~'][~RC^r^n]+^{RecordSet.Open^}^{Connection.Execute^} with option Match Case is also enabled.
Executing this search string at your file example finds it at line 4, 7, 10 and 13. If the search string should also ignore preceding white-spaces, the following UltraEdit style regex will do it with option Match Case enabled:
%[~' ^t^r^n]+[~RC^r^n]+^{RecordSet.Open^}^{Connection.Execute^}
But what happens when instead of "something something" at line 4 a string is before which contains an upper case R or C? Yes, then this line will be also not found.
I don't have an idea how to specify a regex search string which returns 100% correct result for even this situation. Wait ... I have an idea ... yes, this works in UltraEdit style:
%[~' ^t^r^n]+^{*RecordSet.Open^}^{*Connection.Execute^}
The * match inside every OR expression, that's the trick to do this search.
By the way: My prefered file manager
Total Commander supports Perl regex search for text in files (and also regex for the file names) and creates a list of files (not a list of the lines where the string is found). You can click on a file and press F3 to view the file content. Once again F3 (Find next) and you can see the line where the search string was found. If this line must be edited, back to the Total Commander window and F4 to open file in the editor while the viewer window is still open. Reads much more complicated as it really is if you have done these steps several hundreds of times. I nearly always use Total Commander for search something in files instead of the Find In Files command of UE because the search of Total Commander is much more powerful which I also have reported to IDM.