Spanning Of Characters

Spanning Of Characters

\{M\} Repeat previous regular expression exactly M times

\{M,\} Repeat the previous regular expression M or more times

\{M,N\} Repeat the previous regular expression at least M times and not to exceed N times

* Shorthand notation for \{0,\}

+ Shorthand notation for \{1,\}

? Shorthand notation for \{0,1\}

Previous slide Next slide Back to the first slide View Graphic Version

Notes:

In the previous slides we have examined powerful examples of spanning characters; when using the asterisk (*), plus sign (+), or question mark (?).

Regular Expressions includes additional features of spanning characters by indicating the minimum and maximum times an expression can occur; along with specifying that an expression must occur exactly n times.

There have been political wars stating that shorthand notations ought to be avoided. However, whether you use them or not is one thing; you must still be able to interpret regular expression completed by a previous person.

The previous slides have demonstrated the power these features provide. Consider the power added when we can define how to span an expression ourselves.