'use strict';

/* Filters */

var myappFilters = angular.module('myappFilters', []);

myappFilters.filter('checkmark', function() {
	return function(input) {
		return input ? '\u2713' : '\u2718';
	};
});

myappFilters.filter('textFormat', function() {
	return function(input) {
		return input.replace(/\n/g, "<"+"br/>");
	};
});

myApp.filter('urlToLink', function () {
    var urlPattern = /(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&amp;:\/~+#-]*[\w@?^=%&amp;\/~+#-])?/gi;
    
    return function (text, target) {
    	var resp = "";
        resp += text.replace(urlPattern, '<a target="' + target + '" href="$&">$&</a>');
        return resp;
    };
});


@@ -479,17 +479,59 @@
 gi;%0A    
+var imgPattern = /%5C%5Bimg%5C%5D(.*?)%5C%5B%5C/img%5C%5D/i;
 %0A
-
     retu
@@ -587,16 +587,18 @@
         
+//
 resp += 
@@ -670,16 +670,107 @@
 %3C/a%3E');%0A
+        resp += text.replace(imgPattern, '%3Ca target=%22' + target + '%22 href=%22$&%22%3ETEST%3C/a%3E');%0A
         

test img