Movable Type: Change URL using regex replace

405 Views Asked by At

In my <mt:EntryBody> text I have few urls which I want to change the pointing address.

http://www.myblog.com/blog/content/fruit/apple.html

to

http://www.myblog.com/blog/apple/

In this case word "fruit" and "apple" would be the variable. I would like to use regex_replace modifier to change every URL in EntryBody.

How would I write this?

1

There are 1 best solutions below

0
On BEST ANSWER

Try this ?

<mt:EntryBody regex_replace="/content\/\w*\/([^\.]*)\.html/","$1/">

$1 will get the info from what matched inside "( )"