Find Jobs
Hire Freelancers

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

$10-30 USD

Concluído
Publicado há mais de 5 anos

$10-30 USD

Pago na entrega
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 do Projeto: 17937649

Sobre o projeto

1 proposta
Projeto remoto
Ativo há 6 anos

Quer ganhar algum dinheiro?

Benefícios de ofertar no Freelancer

Defina seu orçamento e seu prazo
Seja pago pelo seu trabalho
Descreva sua proposta
É grátis para se inscrever e fazer ofertas em trabalhos
Concedido a:
Avatar do Usuário
$20 USD em 1 dia
0,0 (0 avaliações)
0,0
0,0

Sobre o cliente

Bandeira do(a) UNITED STATES
New York, United States
5,0
2
Método de pagamento verificado
Membro desde abr. 15, 2016

Verificação do Cliente

Obrigado! Te enviamos um link por e-mail para que você possa reivindicar seu crédito gratuito.
Algo deu errado ao enviar seu e-mail. Por favor, tente novamente.
Usuários Registrados Total de Trabalhos Publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Carregando pré-visualização
Permissão concedida para Geolocalização.
Sua sessão expirou e você foi desconectado. Por favor, faça login novamente.