Excluding strings using regular expressions

I worked on creating a regular expression that will include all the patterns except "time", "hour", "minute", so this worked out:

^(?:(?!time).)*$

how can i add another 2 words? I tried to do the following, but this is not true.

^(?:(?![time][hour][minute]).)*$

Is there a better way to do this?

I am not adding values ​​that can be accepted as they range from numbers to alphabets to characters, etc.

Please, help.

thank

+1
source share
3 answers
^(?:(?!time|hour|minute).)*$

|is an alternation. This means that at all points in the line we are not looking at any of these expressions (time, hour or minute). []incorrect because it creates a character class.

, , (a t, i, m e), (a h, o, u r) ..

+1

, , "", "", "" "". - ...

^(?!.*(time|hour|minute).*).*$
0

: !/time|hour|minute/? .

0

All Articles