Ajax software
Free javascripts
↑
Main Page
2.
Use Ctrl+F to open the Find And Replace dialog box.
3.
Check the Regular Expression check box and the Match Case check box.
4.
Enter the regular expression pattern
ABC[0-9]*
in the Search For text box.
5.
Click the Find All button, and inspect the matches that are highlighted.
Figure A-17 shows the matches in OpenOffice.org Writer. As you can see, all of the part numbers match the
pattern.
Figure A-17
Before working through a couple of the matches, briefly look at part of the regular expression pattern,
[0-9]*
. The asterisk applies to the character class
[0-9]
, which I call a
chunk.
Why does the first part number
ABC
match? When the regular expression engine is at the position imme-
diately before the
A
of
ABC
, it attempts to match the next character in the part number with an uppercase
A
.
Because the first character of the part number
ABC
is an uppercase
A
, there is a match. Next, an attempt is
made to match an uppercase
B
. That too matches, as does an attempt to match an uppercase
C
. At that
333
Appendix A: Simple Regular Expressions
bapp01.qxd:bapp01 10:47 333
Ajax software
Free javascripts
→