jeromemacias/webistrano — Issue #5: Add new host failed with "Name is not a valid hostname or IP"
Author: zedtux
Created: 2012-02-29 11:12:44+00:00
State: open

Today I'm trying to add a new host (using its hostname) but I have the error message

Name is not a valid hostname or IP

I've checked the regex that's used:

````ruby
"" =~ /\A[a-zA-Z0-9\_\-\.]+\Z/
=> nil
>> "myhostname" =~ /\A[a-zA-Z0-9\_\-\.]+\Z/
=> 0
>> ("myhostname" =~ /\A[a-zA-Z0-9\_\-\.]+\Z/) == true
=> false
>> ("" =~ /\A[a-zA-Z0-9\_\-\.]+\Z/) == true
=> false
````

`nil` will return false, but 0 will not be true I think.
Do you have any test on this ?