At work I was faced with a problem — to rewrite all the URLs of a website that have underscores in, to dashes. This is to aid a painful transition to manage the website with the MODx php CMS.
Here is the mod_rewrite code that converts any underscores in an URL to dashes.
# Rewrite underscores for dashes in URLs – upto 6 underscores
RewriteCond %{REQUEST_URI} ^(.*)_(.*)/$
RewriteRule (.*)_(.*)/ http://www.microplop.com$1-$2/ [R=301]
RewriteCond %{REQUEST_URI} ^(.*)_(.*)_(.*)/$
RewriteRule (.*)_(.*)_(.*)/ http://www.microplop.com$1-$2-$3/ [R=301]
RewriteCond %{REQUEST_URI} ^(.*)_(.*)_(.*)_(.*)/$
RewriteRule (.*)_(.*)_(.*)_(.*)/ http://www.microplop.com$1-$2-$3-$4/ [R=301]
RewriteCond %{REQUEST_URI} ^(.*)_(.*)_(.*)_(.*)_(.*)/$
RewriteRule (.*)_(.*)_(.*)_(.*)_(.*)/ http://www.microplop.com$1-$2-$3-$4-$5/ [R=301]
RewriteCond %{REQUEST_URI} ^(.*)_(.*)_(.*)_(.*)_(.*)_(.*)/$
RewriteRule (.*)_(.*)_(.*)_(.*)_(.*)_(.*)/ http://www.www.microplop.com$1-$2-$3-$4-$5-$6/ [R=301]
RewriteCond %{REQUEST_URI} ^(.*)_(.*)_(.*)_(.*)_(.*)_(.*)_(.*)/$
RewriteRule (.*)_(.*)_(.*)_(.*)_(.*)_(.*)_(.*)/ http://www.microplop.com$1-$2-$3-$4-$5-$6-$7/ [R=301]
Hope this helps