Homework: Ruby Regular Expressions

Purpose

Preparation

This exercise may be done with a partner.

Regex

This assignment provides practice with some of the basic regular expression capabilities. You should:

  1. Download the unit tests, name the file regex_practice_tester.rb.
  2. Create a module named RegexPractice in a file named regex_practice.rb.
  3. Write the required methods (pay attention to hints). When you run regex_practice_tester.rb your output should be similar to the output below(i.e., 26 assertions, 0 failures, 0 errors).
$ ruby regex_practice_tester.rb
Run options: --seed 14369

# Running:

.......

Finished in 0.005669s, 1234.7171 run/s, 4586.0920 assertion/s.

7 runs, 26 assertions, 0 failures, 0 errors, 0 skips

Rubric

This exercise is worth 16 points.

Points Metric
2 ruby_begins_lines
2 get_language
4 is_complex – must pass all tests
2 what_is_cool
2 what_i_like
2 get_last_word
2 get_price

For ease of grading, ensure the grader can execute your tests by entering ruby regex_practice_tester.rb at the command line.