in reply to Re: Regex for max length float
in thread Regex for max length float
Of course! I forgot that braces are inherently range operators, so this should actually do the trick for me:
$max_lhs = $precision - $scale; $max_rhs = $scale; $float =~ m/ \A # beggining of string \d{0,$max_lhs} # 0 to $max_lhs digits \. # decimal point \d{0,$max_rhs} # 0 to $max_rhs digits \z # end of string /xms;
I know the notion of what I'm calling 'precision' is confusing. I'm actually trying to check for the format of floats before inserting them into an Oracle number field and that's what Oracle calls them:
precision - total number of digits
scale - digits on the rhs
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Regex for max length float
by johngg (Canon) on Mar 14, 2007 at 15:37 UTC | |
by agianni (Hermit) on Mar 14, 2007 at 16:27 UTC | |
by ikegami (Patriarch) on Mar 14, 2007 at 16:32 UTC | |
|
Re^3: Regex for max length float
by Not_a_Number (Prior) on Mar 14, 2007 at 17:16 UTC | |
by agianni (Hermit) on Mar 14, 2007 at 19:58 UTC | |
by jeanluca (Deacon) on Mar 14, 2007 at 19:34 UTC |