about s.equals

How do I make this sentence:while (s.equals("hi"))to be negative?plz help:)
[161 byte] By [Ogara] at [2007-11-27 9:45:56]
# 1
while (!s.equals("hi"))You could have continued in your other thread, no need to open a new one for related questions
PhHeina at 2007-7-12 23:55:28 > top of Java-index,Java Essentials,New To Java...
# 2
!
prometheuzza at 2007-7-12 23:55:29 > top of Java-index,Java Essentials,New To Java...
# 3
Can't one do that with regex? Something likePattern p = new Pattern("^(hi)");while(p.matches(s)) ...
CeciNEstPasUnProgrammeura at 2007-7-12 23:55:29 > top of Java-index,Java Essentials,New To Java...
# 4
Thank you all:D problem solved now:)
Ogara at 2007-7-12 23:55:29 > top of Java-index,Java Essentials,New To Java...
# 5

> Can't one do that with regex?

You can, but it doesn't make the solution any simpler: while (!s.matches("hi"))

The "pure" regex version would be while (s.matches("(?!hi$).*"))

One of the most annoying shortcomings of regexes is that they make it so difficult to express such a simple concept.

uncle_alicea at 2007-7-12 23:55:29 > top of Java-index,Java Essentials,New To Java...
# 6
> > Can't one do that with regex?> > You can, but it doesn't make the solution any> simpler:Somehow, I doubt that CeciNEtc....'s goal was simplicity.
petes1234a at 2007-7-12 23:55:29 > top of Java-index,Java Essentials,New To Java...