eregi("[aeiuo]", $value)

I want to return true if $value contains no vowels. I suspect this returns true if there is at least 1 non-vowel.

Thanks

    More like:

    preg_match('/^[^aeiou]*$/i', $value) == 1
      if(preg_match('/^[^aeiou]*$/i', $value))
      {
         // it contains no vowels
      }
      // ...or...
      if( ! preg_match('/[aeiou]/i' $value))
      {
         // it contains no vowels
      }
      

        And just to show that regular expressions aren't necessary:

         if(strcspn($value, 'aeiouAEIOU')==strlen($value))
        {
          // it contains no vowels.
        }

          And just because I'm a trouble-maker, what if the string is "cyst" or "why"? :p

            Write a Reply...