Filter through ionic segmet using *ngSwitch and regex

I wont to filter words depending on chosen segment value e.g segments have values like
| aa | ab | ac | ad | ae | af | … etc. And click on one of the segment should show relevant words e.g click on | ab | should show only words that begin with “ad” and so on.

enter image description here

My current method to solve this (which is not working ofc. )

<ion-segment scrollable mode="md" (ionChange)="filterWords($event)" [(ngModel)]="filter.query">
    <ion-segment-button mode="md" class="ce-sm-segment" value="all">
        <ion-icon name="infinite"></ion-icon>
    <ion-segment-button mode="md" class="ce-sm-segment" value="starred">
        <ion-icon name="star-outline"></ion-icon>
    <ion-segment-button mode="md" *ngFor="let ltr of twoLettersList" class="ion-text-lowercase" value={{ltr}}>
<div [ngSwitch]="filter.q" *ngFor="let word of (words ? words : [])">
    <ion-item *ngSwitchCase="filter.q">

filter = {
    query: 'all',
    q: 'all' as any
filterWords($event) {
    console.log('All: ', $event.detail.value);
    console.log('Query: ', this.filter.query);
    this.filter.q = new RegExp('^' + this.filter.query + '\\w+');
    console.log('Filtered: ', this.filter.q);

Output of regex:
enter image description here