You can simply use gsub to replace the markup with the link as follows.
The only difficult part here is the regular expression /\[\[.*?##URL:(.*?)##ANCHOR:(.*?)\]\]/
which means 'search for the characters [[ and assign everything found between the group delimiter () to $1, everything in the second group to $2 and call the render function with each match.
def render_markup url, anchor
"<a href='#{url}'>#{anchor}</a>"
end
def scan_and_replace content
content.gsub(/\[\[.*?##URL:(.*?)##ANCHOR:(.*?)\]\]/){|m| render_markup($1, $2) }
end
example_content = "Today was a really nice day when I went to the [[LINK_A##URL:http://www.thepark.com##ANCHOR:The park]] where I had a [[LINK_B##URL:http://www.swim.com##ANCHOR:swim]] and this was very nice"
puts scan_and_replace example_content
#=>Today was a really nice day when I went to the <a href='http://www.thepark.com'>The park</a> where I had a <a href='http://www.swim.com'>swim</a> and this was very nice