title: Regex for a word that can't be preceded by another word but must be preceded by certain characters
body: <p>I want to match occurrences of a word in my string. The word cannot be preceded by the word "per", but must be preceded by a word boundary or numbers.  So for example if my word to match were "pie", this would match</p>
  
  <pre><code>"123pie"
  "abc pie"
  "d-pie"
  </code></pre>
  
  <p>but this would not</p>
  
  <pre><code>"per pie"
  "mpie"
  </code></pre>
  
  <p>I was able to figure out how to write a regex that specifies my word cannot be preceded by the word "per" ...</p>
  
  <pre><code>regex = /(?&lt;!per\s)#{Regexp.escape(word)}(\s|$)/i
  </code></pre>
  
  <p>I don't know how to incorporate the other conditions in there.  How can I do that?</p>