Skip to content

Instantly share code, notes, and snippets.

@koki-h
Last active December 21, 2015 07:43
Show Gist options
  • Select an option

  • Save koki-h/3c56243adcf640cca9e8 to your computer and use it in GitHub Desktop.

Select an option

Save koki-h/3c56243adcf640cca9e8 to your computer and use it in GitHub Desktop.
俺が分かる範囲ですべての全角/半角記号を除去(UTF8 とりあえずエラーにならない)
require 'nkf'
string = NKF::nkf( '-WwZ0', string ) #全角記号を半角に変換しておく
string.gsub!(/[\s\!\"\#\$\%\&\'\(\)\-\=\^\~\\\|\@\`\[\]\{\}\;\:\+\*\<\>\,\.\/\?\_]/,"") #とりあえず全部エスケープしたがわけがわからん。。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment