In this project, I learned how to use regular expressions. I practiced building them using Ruby's Oniguruma library.
All code in this directory was tested using Rubular. Rubular is a Ruby-based regular expression editor. It's a handy way to test regular expressions as you write them.
Note: Each Ruby script in the project matches regular expressions based on an argument passed to it via the command line.
-
0. Simply matching School
- 0-simply_match_school.rb: Ruby script that
matches the regular expression
School.
- 0-simply_match_school.rb: Ruby script that
matches the regular expression
-
1. Repetition Token #0
- 1-repetition_token_0.rb: Ruby script that matches
the regular expression
hbnwith between 2-5t's in betweenhbandn.
- 1-repetition_token_0.rb: Ruby script that matches
the regular expression
-
2. Repetition Token #1
- 2-repetition_token_1.rb: Ruby script that matches
the regular expression
hnwith 0 or 1 occurrences ofband 0 or 1 occurrences oftin betweenhandn.
- 2-repetition_token_1.rb: Ruby script that matches
the regular expression
-
3. Repetition Token #2
- 3-repetition_token_2.rb: Ruby script that matches
the regular expression
hbnwith 1 or moret's in betweenhbandn.
- 3-repetition_token_2.rb: Ruby script that matches
the regular expression
-
4. Repetition Token #3
- 4-repetition_token_3.rb: Ruby script that matches the
regular expression
hbnwith 0 or moret's in betweenhbandn.
- 4-repetition_token_3.rb: Ruby script that matches the
regular expression
-
5. Not quite HBTN yet
- 5-beginning_and_end.rb: Ruby script that matches a
regular expression starting with
hand ending withnwith any single character in between.
- 5-beginning_and_end.rb: Ruby script that matches a
regular expression starting with
-
6. Call me maybe
- 6-phone_number.rb: Ruby script that matches a regular expression representing a 10-digit phone number.
-
7. OMG WHY ARE YOU SHOUTING?
- 7-OMG_WHY_ARE_YOU_SHOUTING.rb: Ruby script that matches regular expressions of uppercase letters.
-
8. Textme
- 100-textme.rb: Ruby script that runs statistics on TextMe app text message transcations.
- Output:
[SENDER],[RECEIVER],[FLAGS]where[SENDER]is the sender phone number or name (including country code if present).[RECEIVER]is the receiver phone number or name (including country code if present).[FLAGS]is the flags that were used.