
| Contents |
|||||||||||||||
| [an error occurred while processing this directive] |
6.4 Regular Expression ShortcutsWriting out regular expressions can be problematic. For example, if we want to have a regular expression that matches all digits, we have to write: (0|1|2|3|4|5|6|7|8|9) It would be terribly annoying to have to write such things out. So, Perl gives an incredible number of shortcuts for writing regular expressions. These are largely syntactic sugar, since we could write out regular expressions in the same way we did above. However, that is too cumbersome.
For example, for ranges of values, we can use the brackets, There are lots of these kinds of shortcuts. They are listed in the `perlre' online manual. They are listed in many places, so there is no need to list them again here.
However, as you learn about all the regular expression shortcuts,
remember that they can all be reduced to the original operators we
discussed above. They are simply short ways of saying things that can
be built with regular characters, |