Skip to content
Open

Done #23

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions lib/regex_lab.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
def starts_with_a_vowel?(word)

if word.match(/^[aeiouAEIOU]\w*/)
return true
else
return false
#word.match(/^[aeiouAEIOU]\w+/) ? true : false
end
end

def words_starting_with_un_and_ending_with_ing(text)

#text.scan(/\w+un\w+ing\b/)
text.scan(/un\w+ing\b/)
end

def words_five_letters_long(text)

text.scan(/\b\w{5}\b/)
end

def first_word_capitalized_and_ends_with_punctuation?(text)

text.match(/^[A-Z].+[\.!?]$/) ? true : false
end

def valid_phone_number?(phone)

phone.match(/([0-9] *?){10}|(\([0-9]{3}\)(([0-9]{3}-[0-9]{4})|[0-9]{7})\b)/) ? true : false
end