|
|
>> I meant using regular expressions to help in your parser to decipher
>> numbers.
>
> I fail to see how a pattern matching language is of help here...
Well it seemed from your example, a "number" is quite easily distinguished
from a non-number.
A number takes one of the four forms (where n is 1 or more digits):
n.n
n.
.n
n
And is optionally prefixed by a minus sign, and optionally suffixed by an
exponential term, which takes the form E or e followed by an optional minus
sign followed by one or more digits.
I would use regular expressions to decide if my string matched this form or
not, but maybe your language/library already has similar functions to do
that?
Post a reply to this message
|
|