I just learned about regular expressions, and I understand that they're a pattern used to search for a match in a given string.
I understand how using (/[aeiou]/)
with the start_with?
method works. The regex (/[aeiou]/)
is a class of characters that I am checking for in the given string. And more specifically, I am checking to see if the given string starts with any of those characters in the regex.
However, when I try to use the same pattern with the end_with?
method, I get a TypeError and it seems that the regex cannot be used.
Why is this? To me, both of these methods seem to share a very similar documentation in the Ruby guides.