-2

I have found from another post that this regex: ^(?!.bar).$ mathces everything that does not containing the word bar.

My question is, what do I add to this in order to recognize sentences that start also from a specific word, say 'test'. For example:

test word1 word2 
testasdsd 

and so on.

I have tried adding the word 'test' to the beggining of the above regex but it doesnt work.How can I do it?

Wiktor Stribiżew
  • 561,645
  • 34
  • 376
  • 476

1 Answers1

1

This works for you:

^test(?!.*bar)

ruohola
  • 19,113
  • 6
  • 51
  • 82