Open thomasjrivera opened 9 years ago
Thanks Thomas. I have fixed the error, and changed the usage pattern for regex. Please review the doc. If your use case is still broken i would request you to please make a change and send a pull request.
I'm not sure this fixed was propagated out to bower correctly - I just started using the filters using 'bower install angularjs-filters' and hit this exact problem.
I could not get it to work. I really just needed the regex replace so I just created by own like this.
.filter("regexReplace", function() { // register new filter
return function(input, searchRegex, replaceRegex) { // filter arguments
return input.replace(RegExp(searchRegex), replaceRegex); // implementation
};
})
Perhaps the code library could be updated to use this.
I am trying to use the filter my app but getting syntax errors. Its not liking passing a regex pattern of any kind. Its only working with a string replace.
This works {{ model.photos[1].caption | string.replace:'Mandatory':'' }}
Not working {{ model.photos[1].caption | string.replace:/Mandatory/g:'' }}
Getting unexpected token and Mandatory