In c notation, float number can occur in following shapes:
For creating float regular expresion, I will first create "int regular expresion variable":
(([1-9][0-9]*)|0) will be int
Now, I will write small chunks of float regular expresion - solution is to concat those chunks with or simbol "|".
Chunks:
- (([+-]?{int}) satysfies case 1
- (([+-]?{int})"."[0-9]*) satysfies cases 2 and 3
- ("."[0-9]*) satysfies case 4
- ([+-]?{int}[eE][+-]?{int}) satysfies cases 5 and 6
Final solution (concanating small chunks):
(([+-]?{int})|(([+-]?{int})"."[0-9]*)|("."[0-9]*)|([+-]?{int}[eE][+-]?{int})