regex - 2 words

levino
Giga Guru

Hi there

 

i need to add 2 words to  a regex

 

the below one works 

 

^(?!.*sudo).*$

 

i also need to add the word 'root'

Thanks

Levino

3 REPLIES 3

Amit Verma
Kilo Patron
Kilo Patron

Hi @levino 

 

Can you please describe what you are trying to achieve with this regex ? I assume that you are trying to ignore the matches which contains sudo and root keywords. If yes, you can try below regex :

 

 

^(?!.*(sudo|root)).*$

 

 

Thanks & Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

Maddysunil
Kilo Sage

@levino 

Please try like below

 

^(?!.*(sudo|root)).*$

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks

 

Sumanth16
Kilo Patron

Hi @levino .

 

Please use below regex:

 

^(?!.*(sudo|root)).*$

 

You can dynamically generate regex:

https://regex-generator.olafneumann.org/?sampleText=2020-03-12T13%3A34%3A56.123Z%20INFO%20%20%5Borg....

 

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda