Hi, I am quite new to regular expression and I am kinda stuck on this question. I am using a book which explains it only in short detail. I have an answer but am not sure if I got it right. If someone can please check it and post the correct answer. Thanks, heres the question:
Write down regular expressions that define a pattern to recognise a decimal literal. Decimal literals start with a numeral consisting of one or more digits. This may be followed by an optional decimal part consiting of a decimal point '.' followed by another numeral consisting of one or more digits. Finally this may be followed by an optional exponent consisting of the letter 'E' followed by an optional sign followed by a numeral consisting of one or more digits.
Here's my answer:
([0-9]+ "." [0-9]+ (E|.)* [0-9]+)
I really struggled on the end part of the question. If someone can please have an answer so i have something to work on and learn from on. Thanks!