Skip to content
Browse files

Initial commit

  • Loading branch information...
0 parents commit b50dc119d08cc54e0d98c3a639e0b8f759c90d2f @iangreenleaf committed Feb 28, 2011
Showing with 215 additions and 0 deletions.
  1. +24 −0 01_intro/about.md
  2. +24 −0 02_why/why.md
  3. +150 −0 gogogo/yes.md
  4. +9 −0 one/01_slide.md
  5. +8 −0 showoff.json
24 01_intro/about.md
@@ -0,0 +1,24 @@
+!SLIDE subsection bullets
+# Readable Regexps #
+## With TRegexp ##
+
+* github.com/youngian
+* @iangreenleaf
+* blog.iangreenleaf.com
+
+!SLIDE
+# Ian Young #
+
+!SLIDE
+# Used to do PHP #
+
+!SLIDE
+# Rails is much better #
+
+!SLIDE
+# AMCO Online #
+## (huzzah) ##
+
+!SLIDE
+# 2 SDRuby meetings #
+## (including this one) ##
24 02_why/why.md
@@ -0,0 +1,24 @@
+!SLIDE subsection
+# Why? #
+
+!SLIDE
+# Because I can #
+
+!SLIDE
+# Because I love Regexps #
+
+!SLIDE
+# ...but... #
+
+!SLIDE code
+ /^(\+\d)*\s*(\(\d{3}\)\s*)*\d{3}(-{0,1}|\s{0,1})\d{2}(-{0,1}|\s{0,1})\d{2}$/
+
+!SLIDE
+# What if we used words? #
+
+!SLIDE
+# less compact #
+
+!SLIDE
+# but friendlier #
+
150 gogogo/yes.md
@@ -0,0 +1,150 @@
+!SLIDE subsection
+# Examples! #
+
+!SLIDE ruby
+ @@@ ruby
+ "Your string".rmatch? do "string" end
+
+!SLIDE ruby
+ @@@ ruby
+ "abc".rmatch? { "ab" + "c" }
+
+!SLIDE ruby
+ @@@ ruby
+ "abc".rmatch? { "xyz".or "abc" }
+
+!SLIDE
+# Ever tried to search for "&"? #
+
+!SLIDE ruby
+ @@@ ruby
+ "symbols.*&+galore".rmatch? { ".*&+" }
+
+!SLIDE
+# Precedence #
+
+!SLIDE ruby
+ @@@ ruby
+ "abc".rmatch? { "ab" + ( "z".or "c" ) }
+
+!SLIDE
+# Repetition #
+
+!SLIDE ruby
+ @@@ ruby
+ "aaabc".rmatch? { 1.or_more "a" }
+
+ "aaabc".rmatch? { 5.or_less "a" }
+
+ "aaabc".rmatch? { 3.exactly "a" }
+
+ "aaabc".rmatch? { (1..5).of "a" }
+
+!SLIDE ruby
+ @@@ ruby
+ "aaabc".rmatch? { 0.or_more "a" }
+
+ "aaabc".rmatch? { any "a" }
+
+!SLIDE ruby
+ @@@ ruby
+ "aaabc".rmatch? { 1.or_more "a" }
+
+ "aaabc".rmatch? { some "a" }
+
+!SLIDE
+# Character sets #
+
+!SLIDE ruby
+ @@@ ruby
+ "abc1234.&*".rmatch? { 10.exactly any_char }
+
+!SLIDE ruby
+ @@@ ruby
+ "abc1234".rmatch? { 3.exactly letter }
+
+!SLIDE ruby
+ @@@ ruby
+ "abc1234".rmatch? { 4.exactly digit }
+
+!SLIDE ruby
+ @@@ ruby
+ "abc_123".rmatch? { 7.exactly word_char }
+
+!SLIDE ruby
+ @@@ ruby
+ " ".rmatch? { whitespace }
+
+!SLIDE ruby
+ @@@ ruby
+ "abc".rmatch? { 3.exactly "a".."c" }
+
+!SLIDE
+# Negation #
+
+!SLIDE ruby
+ @@@ ruby
+ "x".rmatch? { word_char.not "x" } # => nil
+
+ "y".rmatch? { word_char.not "x" }
+
+!SLIDE ruby
+ @@@ ruby
+ "x".rmatch? { _not "x" } # => nil
+
+ "y".rmatch? { _not "x" }
+
+!SLIDE
+# Grouping #
+
+!SLIDE
+# Works the old way #
+
+!SLIDE ruby
+ @@@ ruby
+ match = "abc".rmatch do
+ group( "a" + group( "b" ) ) + "c"
+ end
+
+ match.to_a #=> [ "abc", "ab", "b" ]
+
+!SLIDE
+# Named groups #
+
+!SLIDE ruby
+ @@@ ruby
+ match = "abcde".rmatch? do
+ group( :word, any( word_char ) )
+ end
+
+ match[ :word ] #=> "abcde"
+
+!SLIDE
+# Or use blocks #
+
+!SLIDE ruby
+ @@@ ruby
+ match = "abcde".rmatch? do
+ group :word do
+ any word_char
+ end
+ end
+
+ match[ :word ] #=> "abcde"
+
+!SLIDE ruby
+ @@@ ruby
+ 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 ]
9 one/01_slide.md
@@ -0,0 +1,9 @@
+!SLIDE
+# My Presentation #
+
+!SLIDE bullets incremental
+# Bullet Points #
+
+* first point
+* second point
+* third point
8 showoff.json
@@ -0,0 +1,8 @@
+{
+ "name": "Readable Regexps with TRegexp",
+ "sections": [
+ {"section":"01_intro"},
+ {"section":"02_why"},
+ {"section":"gogogo"}
+ ]
+}

0 comments on commit b50dc11

Please sign in to comment.
Something went wrong with that request. Please try again.