Angular2 Filter Array of Objects with pipe using RegExp?
<p>After hours of searching on stackoverflow and google I did not find what I was searching, I did find something that gave me an idea for an alternative solution.</p>

<p><strong>Object example:</strong></p>

<pre><code>items = [
{
    title: "This is title", 
    email: "test@test.com",
    status: "confirmed"
},
{
    title: "This another one", 
    email: "someone@something.com",
    status: "pending"
{    
    title: "Just a random string", 
    email: "me@you.co.uk",
    status: "pending"
{    
]
</code></pre>

<p><strong>The resolution:</strong></p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
  name: 'filter',
  pure: false
})
export class FilterPipe implements PipeTransform {

  transform(value: any, args?: any): any {
    if(args == '') { return value; }

    let query = args.toLowerCase();
    return value.filter(task =&gt;
      task.title.toLowerCase().indexOf(query) &gt; -1 ||
      task.email.toLowerCase().indexOf(query) &gt; -1 ||
      task.status.toLowerCase().indexOf(query) &gt; -1 

    );
    
  }
}</code></pre>
</div>
</div>
</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div *ngFor="item of (items | filter:'this is') "&gt;
   {{item | json}}
 &lt;/div&gt;</code></pre>
</div>
</div>
</p>

<p>This will give me: </p>

<pre><code>{title: "This is title", email: "test@test.com",status: "confirmed"}
</code></pre>

<p>It works as is, but my intention was to make it work with RegExp, I have tried but for some reason I got an error when I used var something = new RegExp(// some rule).</p>

<p>Any idea is much appreciated. </p>