title: Add exceptions to complex regular expression (lookahead and lookbehind utilized)
body: <p>I'd like some help with regular expressions because I'm not really familiar with.
  So far, I have created the following regex:</p>
  
  <pre><code>/\b(?&lt;![\#\-\/\&gt;])literal(?![\&lt;\'\"])\b/i
  </code></pre>
  
  <p>As <a href="https://regex101.com/" rel="nofollow">https://regex101.com/</a> states:</p>
  
  <blockquote>
    <p>\b assert position at a word boundary (^\w|\w$|\W\w|\w\W)</p>
    
    <p><strong>Negative Lookbehind</strong> (?])</p>
    
    <p>Assert that the Regex below does not match</p>
    
    <p>Match a single character present in the list below [#-/>]</p>
    
    <p># matches the character # literally (case insensitive)</p>
    
    <p>- matches the character - literally (case insensitive)</p>
    
    <p>/ matches the character / literally (case insensitive)</p>
    
    <p>> matches the character > literally (case insensitive)</p>
    
    <p>literal matches the characters literal literally (case insensitive)</p>
    
    <p><strong>Negative Lookahead</strong> (?![\&lt;\'\"])</p>
    
    <p>Assert that the Regex below does not match</p>
    
    <p>Match a single character present in the list below [\&lt;\'\"]</p>
    
    <p>\&lt; matches the character &lt; literally (case insensitive)</p>
    
    <p>\' matches the character ' literally (case insensitive)</p>
    
    <p>\" matches the character " literally (case insensitive)</p>
    
    <p>\b assert position at a word boundary (^\w|\w$|\W\w|\w\W)</p>
    
    <p>Global pattern flags</p>
    
    <p>i modifier: insensitive. Case insensitive match (ignores case of
    [a-zA-Z])</p>
  </blockquote>
  
  <p>I want to add two exceptions to this matching rule. 1) if the ">" is preceded by "p", that is for example a <code>&lt;p&gt;</code> starting tag, to match the literal only. 2) Also the literal should only be matched when <code>&lt;</code> is follwed by <code>/p</code>, that is for example a <code>&lt;/p&gt;</code> closing tag.
  How can achieve this ? </p>
  
  <p>Example: only the bold ones should match.</p>
  
  <pre><code>&lt;p&gt;
      **Literal** in computer science is a
      &lt;a href='http://www.google.com/something/literal#literal'&gt;literal&lt;/a&gt;
      for representing a fixed value in source code. Almost all programming 
      &lt;a href='http://www.google.com/something/else-literal#literal'&gt;languages&lt;/a&gt;
      have notations for atomic values such as integers, floating-point 
      numbers, and strings, and usually for booleans and characters; some
      also have notations for elements of enumerated types and compound
      values such as arrays, records, and objects. An anonymous function
      is a **literal** for the function type which is **LITERAL**
  &lt;/p&gt;
  </code></pre>
  
  <p>I know I have over-complicated things, but the situation is complicated itself and I think I have no other way.</p>