Hi Justin,

Justin To wrote:
> I'm stuck trying to write a regular expression for a percentage:
> 
> Examples of what I'm trying to match:
> 
> 1.1, 1.12, 12, 12.1 and 12.12
> 
> 0.00 <= float <= 100.00
> 
> 
> Thanks!

I hate to wheel out this overused quote, but meh: ;)

    Some people, when confronted with a problem, think I know, Ill
    use regular expressions. Now they have two problems.
       Jamie Zawinski, in comp.lang.emacs

(0..100).include? Float(perc_string) rescue false

irb(main):011:0* (0..100).include? Float("0") rescue false
=> true
irb(main):012:0> (0..100).include? Float("100") rescue false
=> true
irb(main):013:0> (0..100).include? Float("100.1") rescue false
=> false
irb(main):014:0> (0..100).include? Float("foo") rescue false
=> false
irb(main):015:0> (0..100).include? Float(".1") rescue false
=> true
irb(main):016:0> (0..100).include? Float("53.2") rescue false
=> true
irb(main):017:0> (0..100).include? Float("-5") rescue false
=> false