A regular expression that does not match "www"

I think that I am very poorly versed in logic.

I need to write a regular expression that matches all but www. It should fit wwwd, abcdand everything else, just not www. (God, please, this should not be very easy).

I use a regex for the Ruby language.

UPDATE: I need to use regex, not just text != 'www'because this is a way to develop an API. It expects a pattern as an argument, not a result.

+5
source share
4 answers

Why regex? Not enough text != "www"?

( look-ahead): ^(?!www$).*

+10

. , .

^(.|..|[^w]..|.[^w].|..[^w]|.....*)$

:

-, , , , 3 w 3 .

+4

, (*), , ^.$|^..$|^....+$|.*[^w].* 1 2 3 , -w.

(*) , , . , .

+1

^.{0,2}([^w].*|.{4,})?$
0

All Articles