Question: Write a regular expression for floating constants according to the following (after K&R): A floating constant consists of an integer part, a dec- imal point,

 Write a regular expression for floating constants according to the following

Write a regular expression for floating constants according to the following (after K&R): A floating constant consists of an integer part, a dec- imal point, a fraction part, an e, and an optionally signed integer exponent. 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. You may use extended regular expression notation such as [0-9] and +, but explain what you mean by each. Hint: make sure your regular expression accepts floating constants such as 1. 0.5e-15 .3e+3 .2 le5 3.5e-4 but not inte- ger constants such as 42 Write a regular expression for floating constants according to the following (after K&R): A floating constant consists of an integer part, a dec- imal point, a fraction part, an e, and an optionally signed integer exponent. 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. You may use extended regular expression notation such as [0-9] and +, but explain what you mean by each. Hint: make sure your regular expression accepts floating constants such as 1. 0.5e-15 .3e+3 .2 le5 3.5e-4 but not inte- ger constants such as 42

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!