htaccess and redirect to new url using regex

Found that solution useful

I think, this is an expensive way to replace underscores with dashes. But this works at least in my test environment. The first rule replaces dashes one by one. The second rule then removes the prefix from the requested URL.

RewriteBase /

# replace underscores with dashes 
RewriteRule (.+?)_(.+) $1-$2 [R=302,L]

# strip "news/index.php"
RewriteRule ^news/index.php/(.*) /$1 [R=302,L]