Quantcast
Channel: OKWAVE 最新質問([技術者向] コンピューター/205)【本日】
Viewing all articles
Browse latest Browse all 38062

正規表現で"-" "0-9"以外を削除したい

$
0
0
正規表現の質問となります。 現在 perl にて開発中です。 やりたいこととしては、任意の文字列の中から "-" "0-9"以外を削除したいです。 例) my $str = "iPhone4s\x{306f}\x{753b}\x{8cea}\x{306f}\x{3010}\x{3010}\x{3044}\x{3044}\x{3011}1.00\x{3011}\x{3051}\x{3069}\x{3001}\x{5f62}\x{304c}\x{3010}\x{3010}\x{53ef}\x{611b}\x{304f}\x{3011}-1.50\x{3011}\x{306a}\x{3044}\x{ff01}iphone3Gs\x{306f}\x{4e38}\x{3044}\x{5f62}\x{304c}\x{3010}\x{3010}\x{7d20}\x{6575}\x{3067}\x{3057}\x{3087}\x{3011}3.00\x{3011}\x{3002}\x{3042}\x{ff5e}\x{3042}\x{3001}\x{3042}\x{3068}\x{306f}\x{96fb}\x{6ce2}\x{304c}\x{6539}\x{5584}\x{3055}\x{308c}\x{305f}\x{3089}\x{3010}\x{3010}\x{3044}\x{3044}\x{3011}0.00\x{3011}\x{306e}\x{306b}\x{306a}\x{3041}"; # $strの値はランダムとします $str =~ s/\D//g; print "$str\n"; 出力結果 -> 41001503300000 成功すれば -> 4100-1503300000 どなた様か教えて頂ければと思いますmm

Viewing all articles
Browse latest Browse all 38062

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>