自由的力量,自由的生活。
line = "abc"if line =~ /Perl|Python/ ##匹配正则表达式 puts "Scripting language mentioned: #{line}" end line.sub(/Perl/, 'Ruby') # replace first 'Perl' with 'Ruby' line.gsub(/Python/, 'Ruby') # replace every 'Python' with 'Ruby'
Copyright @ ivaneeo Powered by: .Text and ASP.NET Theme by: .NET Monster