Create Regex Patterns #8
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request refactors several regex-based utility methods in
lib/regex_lab.rbto improve readability and ensure consistent return types. The changes replace implicit return values with explicit boolean conversions and simplify the regex patterns for clarity.Regex method improvements:
starts_with_a_vowel?: Updated to explicitly return a boolean by using!!and simplified the regex to match words starting with a vowel.words_starting_with_un_and_ending_with_ing: Simplified the regex to scan for words starting with "un" and ending with "ing" using word boundaries.words_five_letters_long: Adjusted the regex to match exactly five-letter words using word boundaries and case-insensitive matching.first_word_capitalized_and_ends_with_punctuation?: Added!!for explicit boolean conversion and refined the regex to check for a capitalized first word and ending punctuation.valid_phone_number?: Ensured consistent return type with!!and updated the regex to match valid phone number patterns more flexibly.