[Rubygems-developers] Gem name validation

John Barnette jbarnette at gmail.com
Thu Oct 1 14:01:07 EDT 2009


On Oct 1, 2009, at 7:41 AM, Josh Susser wrote:

>
> On Sep 30, 2009, at 11:44 PM, John Barnette wrote:
>> I'd like to add an error to Specification#validate if the spec's  
>> name doesn't match /[a-z][a-z0-9-_]*/i. Any objections?  
>> Disregarding obviously malformed specs, all current gem names match.
>
>
> Sounds good, with one minor nitpick: your regexp isn't valid.  A  
> dash in a character class must be in the first position to be a  
> literal dash instead of a range separator.  Use /[a-z][-_a-z0-9]*/i  
> or /[a-z][-\w]*/i instead.

/\A[a-z][a-z0-9_\-]*\Z/i # if you really really need to be that guy :p

> Are we sure today isn't another Monday?

On the contrary, we are *certain* today is another Monday.


~ j.



More information about the Rubygems-developers mailing list