Ajax software
Free javascripts
↑
Main Page
Match Zero to Two Occurrences
1.
Open OpenOffice.org Writer, and open the sample file
Parts.txt
.
2.
Use Ctrl+F to open the Find And Replace dialog box.
3.
Check the Regular Expressions and Match Case check boxes.
4.
Enter the regular expression pattern
ABC[0-9]{0,2}
in the Search For text box; click the Find All
button, and inspect the matches that are displayed in highlighted text, as shown in Figure A-19.
Figure A-19
Notice that on some lines, only parts of a part number are matched. If you are puzzled as to why that is,
refer back to the problem definition. You are to match a specified sequence of characters. You haven’t
specified that you want to match a part number, simply a sequence of characters.
338
Appendix A: Simple Regular Expressions
bapp01.qxd:bapp01 10:47 338
Ajax software
Free javascripts
→