CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2007
    Posts
    28

    Unhappy floating constant

    hey everyone .. i am trying to write a regular expression for the floating constant...here's the definition of floating constant:

    A floating constant consists of an integer part, a decimal point, a fraction part, an e or E, an optionally signed integer exponent and an optional type suffix, one of f, F, l or L. The integer and fraction parts both consist of a sequence of digits. Either the integer part or the fraction part (not both) may be missing; either the decimal point or the e and the exponent (not both) may be missing.

    what i am trying to do is write an expresstion for it similar to this one which was done for natural numbers:

    Natural numbers (integers > 0) can be represented
    using:
    non zero digit ! 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
    digit ! 0 | non zero digit
    natural number ! non zero digit digit *

  2. #2
    Join Date
    Sep 2010
    Posts
    1

    Re: floating constant

    hii all
    can any one post the answer of the above question???
    thanks in advance

  3. #3
    Join Date
    Mar 2004
    Posts
    235

    Re: floating constant

    why not 3 regular expressions?
    1: check if its integer
    2: if its a float
    3: if its of the form 12.323e+3

    those should be simple
    01101000011001010110110001101100011011110010000001110011011001010111100001111001

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured