title: word boundaries preg_replace
body: <p>I would like to catch any piece of string that matches %[a-z0-9], respecting the following examples :</p>
  
  <pre><code>1. %xxxxxxxxxxxxx                                 //match
  2. this will work %xxxxxx but not this%xxxxxxxxx. //match 1st, not 2nd
  3. and also %xxxxxxxxxx.                          //match
  4. just a line ending with %xxxxxxxxxxx           //match
  5. %Xxxxxxxxxxx                                   //no match
  6. 100% of dogs                                   //no match
  7. 65%. Begining of new phrase                    //no match
  8. 65%.Begining of new phrase                     //no match
  </code></pre>
  
  <p>It can be at the begining of the string or at the end, but not in the middle of a word. It can of course be in the string as a word (separated by space).</p>
  
  <p>I have tried </p>
  
  <pre><code>/(\b)%[a-z0-9]+(\b)/
  /(^|\b)%[a-z0-9]+($|\b)/
  /(\w)%[a-z0-9]+(\w)/
  </code></pre>
  
  <p>and others like this, but I can't get it to work like I would. I guess the \b token does not work in example 2 because there is a boundary before the % sign.</p>
  
  <p>Any help would be greatly appreciated.</p>