You are viewing a single comment's thread. Return to all comments →
A simple solution would be checking if the first and last character are the same and can have any word in b/w. ^a+[\w]+a$
^a+[\w]+a$
Then we can repeat it for each of the vowels (added spaces for sake for readability. `/ ^a+[\w]+a$|
^e+[\w]+e$|
^i+[\w]+i$|
^o+[\w]+o$|
^u+[\w]+u$ /`
An advance solution would be to check for the matched value at the starting of the string to the value at end of string. ^([aeiou]).*\1$
^([aeiou]).*\1$
Seems like cookies are disabled on this browser, please enable them to open this website
Day 7: Regular Expressions I
You are viewing a single comment's thread. Return to all comments →
A simple solution would be checking if the first and last character are the same and can have any word in b/w.
^a+[\w]+a$
Then we can repeat it for each of the vowels (added spaces for sake for readability. `/ ^a+[\w]+a$|
^e+[\w]+e$|
^i+[\w]+i$|
^o+[\w]+o$|
^u+[\w]+u$ /`
An advance solution would be to check for the matched value at the starting of the string to the value at end of string.
^([aeiou]).*\1$