space, → | next slide |
← | previous slide |
d | debug mode |
## <ret> | go to slide # |
c | table of contents (vi) |
f | toggle footer |
r | reload slides |
z | toggle help (this) |
/^(\+\d)*\s*(\(\d{3}\)\s*)*\d{3}(-{0,1}|\s{0,1})\d{2}(-{0,1}|\s{0,1})\d{2}$/
"Your string" =~ /string/
"Your string".rmatch? do "string" end
"abc".rmatch? { "ab" + "c" }
"abc".rmatch? { "xyz".or "abc" }
"symbols.*&+galore".rmatch? { ".*&+" }
"abc".rmatch? { "ab" + ( "z".or "c" ) }
"aaa".rmatch? { 1.or_more "a" }
"aaa".rmatch? { 5.or_less "a" }
"aaa".rmatch? { 3.exactly "a" }
"aaa".rmatch? { (1..5).of "a" }
"aaa".rmatch? { 0.or_more "a" }
"aaa".rmatch? { any "a" }
"aaa".rmatch? { 1.or_more "a" }
"aaa".rmatch? { some "a" }
"abc1234.&*".rmatch? { 10.exactly any_char }
"abc".rmatch? { 3.exactly letter }
"1234".rmatch? { 4.exactly digit }
"abc_123".rmatch? { 7.exactly word_char }
" ".rmatch? { whitespace }
"abc".rmatch? { 3.exactly "a".."c" }
"x".rmatch? { word_char.not "x" } # => nil
"y".rmatch? { word_char.not "x" }
"x".rmatch? { _not "x" } # => nil
"y".rmatch? { _not "x" }
match = "abc".rmatch do
group( "a" + group( "b" ) ) + "c"
end
match.to_a #=> [ "abc", "ab", "b" ]
match = "abcde".rmatch? do
group( :word, any( word_char ) )
end
match[ :word ] #=> "abcde"
match = "abcde".rmatch? do
group :word do
any word_char
end
end
match[ :word ] #=> "abcde"
order = "1234567890 Central Processing"
match = order.rmatch? do
group :serial do
some digit
end \
+ some whitespace + \
group :source do
any any_char
end
end
puts "Order #" + match[ :serial ]
puts "Shipped from " + match[ :source ]
fixnum.rb
range.rb
string.rb
def zero_width_positive_lookbehind
...
end