$re = '/site[\s\S]{0,100}\/a>/';
$str = '<body>
<!-- Websites navigation menu -->
<ul class="navbar">
<li><a href="index.html">Home page</a>
<li><a href="musings.html">Musings</a>
In the following code, what is the regex (within Sublime\'s search) for finding "site" (seen within "Websites") and /a> (seen within ) only when there are between 0 and 50 characters of any type in between those two strings? I\'d like to be able to perform searches like this on a regular basis, just changing out the two keywords and a distance, thanks.';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php