I need a regex which will only analyze part of the text. In the following example, I need to find matches before the word CONFIDENTIAL
So in this text:
this is some text for john@domainA.com
this is some text for mary@domainB.com where also pat@domainc.com is copied
CONFIDENTIAL
this is some text for john@domainA.com
this is some text for mary@domainB.com where also pat@domainc.com is copied
The expression should only match the first 3 email address. I tried with something like:
[A-Za-z0-9]{2,30}(@domainA.com|@domainB.com|@domainC.com)(?=CONFIDENTIAL)
But that yields NO match, where as
[A-Za-z0-9]{2,30}(@domainA.com|@domainB.com|@domainC.com)
Matches all emails, I have been playing in this notepad in regex101.com.
https://regex101.com/r/iNpprH/2
Is what I am requesting possible just using regexp?