http://www.perlmonks.org?node_id=415782


in reply to Regex question : How to match \w and just the dash

The regex /^\W^-/ will never match anything, because ^ only matches the beginning of a string, and you have a character (\W) before the second ^.

I think that what you want is this:

s/[^\w-]+//g
That will strip out all characters that are neither \w nor a dash.
--Stevie-O
$"=$,,$_=q>|\p4<6 8p<M/_|<('=> .q>.<4-KI<l|2$<6%s!<qn#F<>;$, .=pack'N*',"@{[unpack'C*',$_] }"for split/</;$_=$,,y[A-Z a-z] {}cd;print lc