Find Jobs
Hire Freelancers

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

$10-30 USD

Завершено
Опублікований over 5 years ago

$10-30 USD

Оплачується при отриманні
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.
ID проекту: 17937649

Про проект

1 пропозиця
Дистанційний проект
Активність 6 yrs ago

Хочете заробити?

Переваги подання заявок на Freelancer

Вкажіть свій бюджет та терміни
Отримайте гроші за свою роботу
Опишіть свою пропозицію
Реєстрація та подання заявок у проекти є безкоштовними
Доручений:
Аватарка користувача
$20 USD за 1 день
0,0 (0 відгуки(-ів))
0,0
0,0

Про клієнта

Прапор UNITED STATES
New York, United States
5,0
2
Спосіб оплати верифіковано
На сайті з квіт. 15, 2016

Верифікація клієнта

Дякуємо! Ми надіслали на вашу електронну пошту посилання для отримання безкоштовного кредиту.
Під час надсилання електронного листа сталася помилка. Будь ласка, спробуйте ще раз.
Зареєстрованих користувачів Загальна кількість опублікованих робіт
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Завантажуємо для перегляду
Дозвіл на визначення геолокації надано.
Ваш сеанс входу закінчився, і сеанс було закрито. Будь ласка, увійдіть знову.