title: How to do lookbehind and lookforward at the same time around a regex?
body: <p>The input is this:</p>
  <pre><code>*Word. Word.* Word word. *…*
  
  &quot;…&quot; Word word. &quot;…&quot;
  
  &quot;…&quot; word. &quot;…&quot;
  </code></pre>
  <p>The following is matching the empty space on the right side of a sentence.</p>
  <pre><code>(?&lt;=[&quot;*]*[A-Z].+?\.[&quot;*]*)\s
  </code></pre>
  <p>If I want to match the empty space on the left side, I have to do this:</p>
  <pre><code>\s(?=[&quot;*]*[A-Z].+?\.[&quot;*]*)
  </code></pre>
  <p>The output should be this (the <code>[]</code> symbolize the matches):</p>
  <pre><code>*Word.[]Word.*[]Word word.[]*…*
  
  &quot;…&quot;[]Woad word.[]&quot;…&quot;
  
  &quot;…&quot; word.[]&quot;…&quot;
  </code></pre>
  <p>How to modify this regex so it matches the empty spaces on both sides of a sentence at the same time?</p>
  <p><a href="https://regexr.com/5tddc" rel="nofollow noreferrer">https://regexr.com/5tddc</a></p>