Replace an array (with identical values) with another array in the_content

I found this article by Jeroen Sormani which solved my problem