Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

working...

  • Loading branch information...
commit cbf7a1941b8ba50462c97e5cf2cfaef42cfc63bd 1 parent bd5cabe
Danish Khan authored
Showing with 10 additions and 10 deletions.
  1. +10 −10 koans/about_regular_expressions.rb
View
20 koans/about_regular_expressions.rb
@@ -108,35 +108,35 @@ def test_dollar_sign_anchors_to_the_end_of_lines
end
def test_slash_b_anchors_to_a_word_boundary
- assert_equal __, "bovine vines"[/\bvine./]
+ assert_equal "vines", "bovine vines"[/\bvine./]
end
# ------------------------------------------------------------------
def test_parentheses_group_contents
- assert_equal __, "ahahaha"[/(ha)+/]
+ assert_equal "hahaha", "ahahaha"[/(ha)+/]
end
# ------------------------------------------------------------------
def test_parentheses_also_capture_matched_content_by_number
- assert_equal __, "Gray, James"[/(\w+), (\w+)/, 1]
- assert_equal __, "Gray, James"[/(\w+), (\w+)/, 2]
+ assert_equal "Gray", "Gray, James"[/(\w+), (\w+)/, 1]
+ assert_equal "James", "Gray, James"[/(\w+), (\w+)/, 2]
end
def test_variables_can_also_be_used_to_access_captures
- assert_equal __, "Name: Gray, James"[/(\w+), (\w+)/]
- assert_equal __, $1
- assert_equal __, $2
+ assert_equal "Gray, James", "Name: Gray, James"[/(\w+), (\w+)/]
+ assert_equal "Gray", $1
+ assert_equal "James", $2
end
# ------------------------------------------------------------------
def test_a_vertical_pipe_means_or
grays = /(James|Dana|Summer) Gray/
- assert_equal __, "James Gray"[grays]
- assert_equal __, "Summer Gray"[grays, 1]
- assert_equal __, "Jim Gray"[grays, 1]
+ assert_equal "James Gray", "James Gray"[grays]
+ assert_equal "Summer", "Summer Gray"[grays, 1]
+ assert_equal nil, "Jim Gray"[grays, 1]
end
# THINK ABOUT IT:
Please sign in to comment.
Something went wrong with that request. Please try again.