As I understand, craft overrides Twig's replace
filter to allow for the use of regex; which is just running preg_replace
under the hood
When running the following regex through preg_replace
in a php page (outside of craft) in order to match non-ASCII characters; it works as expected:
/([^ !"#$%&\'\(\)*\+,-\.\/0123456789:;<=>\?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\]\^\\\_`abcdefghijklmnopqrstuvwxyz{\|}~\n]+)/u
However, when running it through replace
in a template in craft; nothing is matched
Any ideas as to why this is happening and possible solutions?
Thanks