Regular expressions provide a very powerful method of defining a pattern, but they are a bit awkward to understand and to use properly. So let us examine some more examples in detail.
We start with a simple yet non-trivial example: finding floating-point numbers in a line of text. Do not worry: we will keep the problem simpler than it is in its full generality.
We only consider numbers like 1.0 and not 1.00e+01. How do we design our regular expression for this problem?
By examining typical examp...