Regular expression for capuring entire lines that start with either '###' or '*** Entry'

Viewed 636

I have large files that each contain many lines, some lines are prefixed with series of characters, for example:

*** Entry 4 *** 05-17-2021 08:05:36

And

### Scrambled GET_DEVICE_INFO response ###
### VIEW_LOG_RADIO EnabledE(¾ç@VENT_CRIT_MANUF 8 ###

I would like my search to return all lines that begin with either ### or *** Entry, but am seeing unexpected results. i.e. I am seeing content returned that is outside what I intended to include. The closest I have so far is:

^[(###|*** Entry)].*  

It returns the message:

"Reached maximum result size. Check "find_in_files_max_result_size". 176949 matches across 3552 files"

I am looking for suggestions to either improve this attempt, or for an entirely new expression.

Note, I have included the 'Sublime Text' tag only because that happens to be the utility in which I am using because it includes regular expression searches. Please don't exclude your idea due to this tag :)

Edit to address question in comments:

Searching 14 files for "^(###|*** Entry).*$" (regex)

C:\tempExtract\___CR2_ISL_CharacterizationStudy\SummaryDataAnalysislogs\3304.txt:
    1  
    2: *** Entry 1 *** 05-17-2021 06:58:51
    3  *** ID: 49241341 ***
    4  *** PN: 3315185-000 ***
    .
    6  *** Conclusions-Description: ***
    7  
    8: ### Device is not enumerated ###
    9: ### Occurs after 'RelayRelayRelayRelayRelayRelay' ###
   10  
   11  
   12: *** Entry 2 *** 05-17-2021 07:00:17
   13  *** ID: 49236843 ***
   14  *** PN: 3315185-000 ***
   ..
   16  *** Conclusions-Description: ***
   17  
   18: ### Error in MTI command ###
   19  
   20  
   21: *** Entry 3 *** 05-17-2021 07:01:48
   22  *** ID: 48729163 ***
   23  *** PN: 3315185-004 ***
   ..
   25  *** Conclusions-Description: ***
1 Answers

The square brackets in a regex mean "find exactly one from the list of characters inside" so ^[abc].* means "from the start of the line, find exactly one of the characters a, b or c followed by zero or more other characters". So ^[(###|*** Entry)].* literally means "from the start of the line, find exactly one of the characters listed in the square brackets followed by more of any character" - which would match almost every line in the file.

But, ^(###|\*\*\* Entry).* (without the square brackets) means "from the start of the line, find either ### or *** Entry followed by zero or more characters" - you need the backslashes because the asterisk has a special meaning. And then it puts the part inside the parenthesis into subgroup 1 so if you don't need subgroups you can use a non-capturing version: ^(?:###|\*\*\* Entry).*

You can see ^(?:###|\*\*\* Entry).* in action here: https://regex101.com/r/4aC1d0/1

Related