title: Removing non-alphanumeric characters with sed
body: <p>I am trying to validate some inputs to remove a set of characters. Only alphanumeric characters plus, period, underscore, hyphen are allowed. I've tested the regex expression <code>[^\w.-]</code> here <a href="http://gskinner.com/RegExr/" rel="noreferrer">http://gskinner.com/RegExr/</a> and it matches what I want removed so I not sure why <code>sed</code> is returning the opposite. What am I missing?</p>
  
  <p>My end goal is to input <code>"Â10.41.89.50 "</code> and get <code>"10.41.89.50</code>".</p>
  
  <p>I've tried:</p>
  
  <p><code>echo "Â10.41.89.50 " | sed s/[^\w.-]//g</code> returns <code>Â...</code></p>
  
  <p><code>echo "Â10.41.89.50 " | sed s/[\w.-]//g</code> and <code>echo "Â10.41.89.50 " | sed s/[\w^.-]//g</code> returns <code>Â10418950</code></p>
  
  <p>I attempted the answer found here <a href="https://stackoverflow.com/questions/8571601/skip-remove-non-ascii-character-with-sed">Skip/remove non-ascii character with sed</a> but nothing was removed.</p>