Ajax software
Free javascripts
↑
Main Page
Simple Regular Expressions
This appendix examines some basic aspects of constructing regular expressions. One reason for
working through the simple examples presented in this appendix is to illuminate the regular
expressions used in Chapter 3 and further extend your knowledge of them.
The following exercises use OpenOffice.org Writer — a free document editor that makes it easy to
apply regular expressions to text, and verify that they do what you expected. You can download
this tool from
http://www.openoffice.org
.
The examples used are necessarily simple, but by using regular expressions to match fairly simple
text patterns, you should become increasingly familiar and comfortable with the use of foundational
regular expression constructs that can be used to form part of more complex regular expressions.
One of the issues this appendix explores in some detail is the situation where you want to match
occurrences of characters other than those characters simply occurring once.
This appendix looks at the following:
?
How to match single characters
?
How to match optional characters
This appendix has been “borrowed” from the Wrox title Beginning Regular Expressions
(Wiley, 2005) by Andrew Watt. We recommend this book for further (and more com-
prehensive) reference into the world of regular expressions.
bapp01.qxd:bapp01 10:47 311
Ajax software
Free javascripts
→