Body: <p>I'm looking for a bit of reassurance before reporting a bug(s) in the search builder. On my own site, we have a custom field 'Course Code' which we've previously used for regex searches in the search builder.</p>
  
  <p>However, recently (or since this time last year!) it seems to be broken. I'll attach a series of screenshots below to illustrate my point. </p>
  
  <p>I have attempted to reproduce on the <a href="https://dmaster.demo.civicrm.org" rel="nofollow noreferrer">CiviCRM Demo site</a> by searching in Search Builder using regex for the postal code field. It seems to broken there too. Screnshot at bottom of page.</p>
  
  <p>To summate, am I being an idiot, or is the regex search in search builder broken?</p>
  
  <hr>
  
  <p><strong>Searching by both contact subtype and regex</strong>
  <a href="https://i.sstatic.net/SUruP.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/SUruP.png" alt="Searching by regex and contact subtype"></a>
  Gives us no results.</p>
  
  <hr>
  
  <p><strong>Searching by regex only</strong>
  <a href="https://i.sstatic.net/wvijT.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/wvijT.png" alt="Searching by regex only"></a>
  Gives us an expected result</p>
  
  <hr>
  
  <p><strong>Searching by subtype only</strong>
  <a href="https://i.sstatic.net/gpF3D.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/gpF3D.png" alt="Searching by subtype only"></a>
  Again gives us an expected result</p>
  
  <hr>
  
  <p><strong>Searching by a regex for the year</strong>
  <a href="https://i.sstatic.net/umoSn.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/umoSn.png" alt="Searching by a regex for the year"></a>
  Brings up expected results</p>
  
  <hr>
  
  <p><strong>Searching by regex for year and a text value</strong>
  <a href="https://i.sstatic.net/L5XFc.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/L5XFc.png" alt="**Searching by regex for year and a text value**"></a>
  Theoretically, this should work, and has done in the past. Doesn't now.</p>
  
  <hr>
  
  <p><strong>CiviCRM Demo Site</strong>
  <a href="https://i.sstatic.net/brliX.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/brliX.png" alt="CiviCRM Demo Site broken too"></a>
  There are plenty of 5-digit postal codes in the contact database starting with 7.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-11-17T15:11:16.120Z
Comments.Text: Is working here....I'm using 5.6.1. Make sure you have the correct address type for the post code. BTW starting with 5 would be ^5 in regex. But you should still get something just with the 5
Comments.UserDisplayName: Tony Horrocks
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-11-18T22:22:20.473Z
Comments.Text: After a bit more experimentation, my site is fine with using numbers, but when I add a letter into the string, it breaks.
Comments.UserDisplayName: termdark
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-11-19T11:43:12.583Z
Comments.Text: Tried on 5.8.alpha1 and it seems ok.  Might be worth double checking that you are looking for the right location.  Your screenshot shows searching for Home but if your postcodes with letters are eg Billing then they won't show up.
Comments.UserDisplayName: Aidan
Tags: <search-builder>
Title: Regex broken in search builder
ThreadText: # Regex broken in search builder
  
  (Asked by: username_0 on 2018-11-16)
  
  I'm looking for a bit of reassurance before reporting a bug(s) in the search builder. On my own site, we have a custom field 'Course Code' which we've previously used for regex searches in the search builder.
  
  However, recently (or since this time last year!) it seems to be broken. I'll attach a series of screenshots below to illustrate my point.
  
  I have attempted to reproduce on the [CiviCRM Demo site](https://dmaster.demo.civicrm.org) by searching in Search Builder using regex for the postal code field. It seems to broken there too. Screnshot at bottom of page.
  
  To summate, am I being an idiot, or is the regex search in search builder broken?
  
  ---
  
  **Searching by both contact subtype and regex**
  [![Searching by regex and contact subtype](https://i.sstatic.net/SUruP.png)](https://i.sstatic.net/SUruP.png)
  Gives us no results.
  
  ---
  
  **Searching by regex only**
  [![Searching by regex only](https://i.sstatic.net/wvijT.png)](https://i.sstatic.net/wvijT.png)
  Gives us an expected result
  
  ---
  
  **Searching by subtype only**
  [![Searching by subtype only](https://i.sstatic.net/gpF3D.png)](https://i.sstatic.net/gpF3D.png)
  Again gives us an expected result
  
  ---
  
  **Searching by a regex for the year**
  [![Searching by a regex for the year](https://i.sstatic.net/umoSn.png)](https://i.sstatic.net/umoSn.png)
  Brings up expected results
  
  ---
  
  **Searching by regex for year and a text value**
  [![**Searching by regex for year and a text value**](https://i.sstatic.net/L5XFc.png)](https://i.sstatic.net/L5XFc.png)
  Theoretically, this should work, and has done in the past. Doesn't now.
  
  ---
  
  **CiviCRM Demo Site**
  [![CiviCRM Demo Site broken too](https://i.sstatic.net/brliX.png)](https://i.sstatic.net/brliX.png)
  There are plenty of 5-digit postal codes in the contact database starting with 7.
  
  **Tags:** search-builder
  
  > **Comments:**
  > **username_1**: Is working here....I'm using 5.6.1. Make sure you have the correct address type for the post code. BTW starting with 5 would be ^5 in regex. But you should still get something just with the 5  
  > **username_0**: After a bit more experimentation, my site is fine with using numbers, but when I add a letter into the string, it breaks.  
  > **username_2**: Tried on 5.8.alpha1 and it seems ok.  Might be worth double checking that you are looking for the right location.  Your screenshot shows searching for Home but if your postcodes with letters are eg Billing then they won't show up.  
  
  ---
  
  ## 0 answers
  
  