Это регулярное выражение должно соответствовать тому, что вы хотите:
(start((?!start).)*?end)
Используйте метод re.findall
и однострочный модификатор re.S
, чтобы получить все вхождения в многострочной строке:
re.findall('(start((?!start).)*?end)', text, re.S)
Смотрите здесь .
В вашем HTML
<ion-searchbar type="text" debounce="500" (ionInput)="getItems($event)"></ion-searchbar>
<ion-list *ngIf="isItemAvailable">
<ion-item *ngFor="let item of items">
{{ item }}
</ion-item>
</ion-list>
в вашем файле
this.isItemAvailable = false; // initialize the items with false
initializeItems(){
this.items = ["Ram","gopi", "dravid"];
}
getItems(ev: any) {
// Reset items back to all of the items
this.initializeItems();
// set val to the value of the searchbar
const val = ev.target.value;
// if the value is an empty string don't filter the items
if (val && val.trim() != '') {
this.isItemAvailable = true;
this.items = this.items.filter((item) => {
return (item.toLowerCase().indexOf(val.toLowerCase()) > -1);
})
}
}