php|architect's Guide to Web Scraping with PHP - Wind Business ...
php|architect's Guide to Web Scraping with PHP - Wind Business ...
php|architect's Guide to Web Scraping with PHP - Wind Business ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
PCRE Extension ” 145<br />
Anchors<br />
Y o umay want <strong>to</strong> check for the presence of a pattern at the beginning or end of a<br />
string rather than simply checking <strong>to</strong> see if the pattern is contained anywhere <strong>with</strong>in<br />
the string. The meta-characters for this are collectively referred <strong>to</strong> as anchors.<br />
<br />
• ˆ (also called the circumflex character) is used at the beginning of an expression<br />
<strong>with</strong>in a pattern <strong>to</strong> indicate that matching should start at the beginning<br />
of a string.<br />
• Likewise, $ is used <strong>to</strong> indicate that matching of an expression <strong>with</strong>in a pattern<br />
should s<strong>to</strong>p at the end of a string.<br />
• When used <strong>to</strong>gether, ˆ and $ can indicate that the entirety of $string matches<br />
the pattern exactly.<br />
i<br />
St a r t of St r i n g or Line<br />
It’s important <strong>to</strong> note that the behavior of these two opera<strong>to</strong>rs can vary. By default,<br />
they match the beginning and end of $string. If the multi-line modifier is used, they<br />
match the beginning and end of each line in $string instead. This will be covered in<br />
more detail later in the Mo d i fi e r s section of this chapter.