I've created a regex pattern to match URLs like this:
/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/
Now, I need to incorporate this regex into a filter that will specifically extract the URL from a given value:
The area where I want to implement this is here:
return arr[i].text;
Filter Implementation
app.filter('getFirstCommentFrom',function(){
return function(arr, user){
for(var i=0;i<arr.length;i++)
{
if(arr[i].from.username==user)
return arr[i].text;
}
return '';
}
})
{{p.comments.data|getFirstCommentFrom:'machinas_test'}}
I'm unsure about how to incorporate this functionality.