chitsheet /gsub.yml

Language YAML Lines 9
MD5 Hash a0c71a29a0f7a0750684de672f51e368
Repository https://github.com/felixgao/chitsheet.git View Raw File
1
2
3
4
5
6
7
8
--- 
gsub: |-
  >> "dog cat".gsub(/(dog) cat/, "cat")
  => "cat"
  >> "dog cat".gsub(/(dog) cat/, '\1')
  => "dog"
  >> "20 dogs".gsub(/\d+/) { |num| num.to_i + 1 }
  => "21 dogs"
Back to Top