Write me a regular expression for regex (or grep!) that combines AND & OR operators...

Suoritettu Julkaistu 5 vuotta sitten Maksettu toimituksen yhteydessä
Suoritettu Maksettu toimituksen yhteydessä

I need a regular expression that will capture a combination of (a combination of?) two words in a sentence, with wildcards.

Simply put, it would capture any sentence with "launch" OR "began" AND "20*" OR "198*"

Therefore, if a sentence said: "we launched the product in 1981" it would be captured.

Same as if the words were reversed ("in 1981 we launched"). Same as if it said "began" instead of "launched."

The regex you provide should also allow me to customize it, so that it captures ONLY "launch" but also "launched" with some simple mods I can make.

Here are some sample texts. It should capture 1 and 2 but not 3.

1. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod

tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,

quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo

consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse

cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non

proident, sunt in culpa qui officia deserunt mollit anim id est laborum __2013 launched the beginning of the project__.

2. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod

tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,

quis nostrud exercitation __began in 1984__ ullamco laboris nisi ut aliquip ex ea commodo

consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse

cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non

proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

3. Ut labore et dolore magna aliqua. Ut enim ad minim veniam,

quis nostrud exercitation __beginning in 1990__ ut labore et dolore magna aliqua. Ut enim ad minim veniam, dolore magna aliqua. Ut enim ad minim veniam, dolore magna aliqua. Ut enim ad minim veniam,

==========PRO TIP=========

There seems to be a partial answer here: [login to view URL]

But I feel that it's a combination of the solutions in

^.*\b(one|two|three)\b.*$

and

^(?=.*?\bone\b)(?=.*?\btwo\b)(?=.*?\bthree\b).*$

It's certainly not

(198)|(200)(.+?)(began)|(launch)(.*)

which captures ALL occurrences of ANY of the items.

==========SECOND PRO TIP=========

I will probably be using either PowerGREP in windows or maybe just grep via command line, so the solution could be tailored to that?

This will be for finding these expressions in a folder of thousands of txt and html files and extracting them for analysis.

Regular Expressions

Projektin tunnus: #17937649

Tietoa projektista

1 ehdotus Etäprojekti Aktiivinen 5 vuotta sitten

Myönnetty käyttäjälle:

$20 USD 1 päivässä
(0 Arvostelua)
0.0