Struggling a bit with this one; I'm after correct syntax for throwing out line breaks with an empty string. The replacement doesn't seem to understand "\r\n" literal, and my attempts at using valid [php] regular expression syntax have failed silently. (NB: apparently not all valid regexps work in Squiz)
Struggling a bit with this one; I'm after correct syntax for throwing out line breaks with an empty string. The replacement doesn't seem to understand "\r\n" literal, and my attempts at using valid [php] regular expression syntax have failed silently. (NB: apparently not all valid regexps work in Squiz)
The problem with the replace modifier is, even though it uses the php preg_replace() function, the argument that you use actually gets stripped earlier in the code. So, when it gets to that function, what you entered probably isn't even there anymore.
This returns nothing. But, when looking into the source of that modifier, and echoing out what the $toReplace and $replaceWith vars have I realize that it left me with the following regex:
(\n)+
Not exactly what I started with. So, somewhere earlier in the code the regex is getting stripped from the keyword.
Thanks for helping preserve my sanity! I was really unable to get replacement working for anything other than basic strings - for instance, I couldn't figure out a way to replace "<br/>" tags (as a workaround, I was considering %...^nl2br^replace:<br/>:% instead of the above)
I couldn't figure out a way to replace "<br/>" tags (as a workaround, I was considering %...^nl2br^replace:<br/>:% instead of the above)
You can't. Somewhere before the modifiers get replaced that regex string gets stripped. Not sure if there is a list of characters that are not allowed. But I put in a bug report for this so I hope it will get fixed.
Basically just replaces the line break with a space. Not an ideal solution, but pretty close and might be just enough for what you need. Hope that helps.
Basically just replaces the line break with a space. Not an ideal solution, but pretty close and might be just enough for what you need. Hope that helps.