[ create a new paste ] login | about

Link: http://codepad.org/s31AGODQ    [ raw code | output | fork ]

Ruby, pasted on Mar 12:
1
2
3
4
5
6
7
class String
  def to_case_insensitive_regex
    /#{gsub(/./) {|c| "[#{c.downcase}#{c.upcase}]"}}/
  end
end

puts "teStEr".to_case_insensitive_regex


Output:
1
2
(?-mix:[tT][eE][sS][tT][eE][rR])



Create a new paste based on this one


Comments: