Ajax software
Free javascripts
↑
Main Page
Figure A-5
The pattern
rr
indicates to the regular expression engine that an attempt should be made to match the
lowercase alphabetic character
r
; then, if that first match is successful, an attempt should be made to
match the next character. The entire match is successful if the second character is also a lowercase
r
.
If the attempt to match the first character fails, the next character is tested to see if it is a lowercase
r
. If it
is not a lowercase
r
, the match fails, and a new attempt is made to match the following character against
the first
r
of the regular expression pattern.
You can also try this out in the Komodo Regular Expression Toolkit, as shown in Figure A-6, which matches
successive lowercase
m
s. You can download the latest trial version of the Komodo IDE, which includes the
Regular Expression Toolkit, from
http://activestate.com/Products/Komodo
. Komodo version 2.5
is used in this appendix. Clear the regular expression and the test text from the Komodo Toolkit. Enter
mammals
in the area for the string to be matched, and type
m
in the area for the regular expression. At that
point, the initial
m
of
mammals
is matched. Then type a second
m
in the area for the regular expression, and
the highlight indicating a match moves to the
mm
in the middle of
mammals
, as you can see in Figure A-6.
318
Appendix A: Simple Regular Expressions
bapp01.qxd:bapp01 10:47 318
Ajax software
Free javascripts
→