Replace backslash

(Gavin) #1


I have the following:


Basically I’d like to replace \ with \ but I cant seem to find the magic pattern.
I have tried different numbers of \ on either side of the colon.

Any ideas ?


(Bart Banda) #2

Hi Gavin, what version of Matrix are you using?

Also, why do you need a replace keyword modifier to replace a character with the same character?

(Gavin) #3 - ah, looks like the post editor has messed around with my slashes.
I want to replace a single backslash with a double backslash.
It looks like I can use json_encode though - the only oddity being that also seems to replace some characters (like £) with unicode codes.

(Bart Banda) #4

Ah cool, that makes sense.

Try this replacement:


Apparently there’s some buggy behaviour with backslashes and the replace keyword modifier in Matrix, especially when used with the colon character.

From our developer:

I think know why %asset_metadata_text^replace:\\:\\\% didn’t worked. it loos like teh argument char : is getting escaped due to \ preceding it. So basically the whole \\:\\\ is interpreted by modifier as the search regex (edited)

(Gavin) #5

Great - thanks for the update, I will give that a try