I want to replace anything that is not an alphanumeric character, forward slash, period, underscore or hyphen with a hyphen.

This works:

RewriteRule ^(.*)[^/.a-zA-Z0-9_\-](.*)$ $1\-$2

However, when I add an [N] flag to the end of it in order to get more than one occurence, it crashes the server.

Any ideas why?