title: How do I use regex query to search for a string that contains dots?
body: <p>I have a search aggregation for my MongoDB. In that aggregation I use <strong>query</strong> in <strong>regex</strong> like this:</p>
  <pre><code>$search: { 
    ... 
    'regex': { 
      'query': '.*?0.*', 
      'path': ...   
    }, 
      'highlight': ...
  }
  </code></pre>
  <p>The ?0 is replaced by the search parameter.</p>
  <p>I have the following string in the database: <code>TEST01.test.local</code></p>
  <p>When I search <strong>&quot;Test01&quot;</strong> or <strong>&quot;test.local&quot;</strong> it finds the string without any problems. But as soon as the first dot in the string is involved in the search query, it starts to return empty. So if I search <strong>&quot;TEST01.test.local&quot;</strong>, <strong>&quot;TEST01.test&quot;</strong> or even <strong>&quot;1.t&quot;</strong> it doesn't find anything, but if I search <strong>&quot;t.l&quot;</strong> it finds the string.</p>
  <p>So for example when I search <strong>&quot;TEST01.test.local&quot;</strong> it looks like this: <code>'query': '.*TEST01.test.local.*'</code>, but the query returns nothing even though there is data with that value in my MongoDB.</p>
  <p>What am I doing wrong here?</p>