02.06.2013 Views

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Figure 9-12. Adding an optional check for the word regular<br />

CHAPTER 9 ■ PERFORMING FORM VALIDATION WITH REGULAR EXPRESSIONS<br />

Now exp<strong>and</strong> the pattern to match the word expression as an alternative to es:<br />

/(reg(ular\s)?ex(pression|es)?)/i (see Figure 9-13).<br />

Figure 9-13. Adding alternation to match expression<br />

Finally, add an optional s to the end of the match for expression:<br />

/(reg(ular\s)?ex(pressions?|es)?)/i (see Figure 9-14).<br />

327

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!