string = 'cccbbbaaaddd'
pattern = 'a.*'
string.match(pattern)
string.match(pattern).to_s
string.match(pattern).to_s[-1]
string.match(pattern).to_s[0]
string.match(pattern).pre_match
string.match(pattern).pre_match[0]
string.match(pattern).pre_match[-1]
string.match(pattern).post_match
string.match(pattern).post_match[0]
string.match(pattern).post_match[-1]
"aaaarrrrssssbbbbcccc".match("[a-z && [^ab]]+").to_s
"hello world".match(/(\w)\1/)
"hello world".match(/?<name>(\w)\k<name>/)
"pipipiworld".match(/(\w+)\1\1/)
string.gsub(/#{pattern}/) {"222"}
"aaaarrrrssssbbbbcccc".gsub(/[a-z && [^ab]]+/) {"AAAA"}
"hello world".gsub(/(\w)\1/) {"AAAA"}
"pipipiworld".gsub(/(\w+)\1\1/) {"super mario "}