Ionic 2 + Regex

Good evening,

I implemented a service to consume data through an API. I get a text and inside this text a URL appears.

What I wanted was to regex treat this text and return only the URL.

Is it possible to help me in the function question to get a string and apply regex and return the result?

This all in ionic 2.

Thank you very much.

Can you share some code?
What do you have, what have you tried?

In ionic 1 i have this code:

var myApp = angular.module(‘myApp’, []);
myApp.filter(‘regex’, function() {
return function(val){
var RegExp = /src="(https?://.*.(?:png|jpg))/;
var match = RegExp.exec(val);
return match[1];
myApp.controller(‘ctrl’, function($scope){
$scope.user = {‘author’: "src=“”};


{{ | regex }}

but i need to do this in ionic 2, but i can’t do it.

Look at using Angular Pipes to achieve this.