-3

Constraints

The length of string is . String consists of lowercase letters only (i.e., [a-z]).

Output Format

The function must return a RegExp object that matches any string beginning with and ending in the same vowel.

Sample Input 0

bcd

Sample Output 0

false

Sample Input 2

abcda

Sample Output 2

true

Need Help Plz ???

  • 2
    You tend to get best results on this site by showing effort on the homework problem, and also letting us know where you are stuck. Please consider doing these things here. – Tim Biegeleisen Oct 13 '20 at 16:04
  • What regex have you used so far? May you show us it with the JS function you've written? – evolutionxbox Oct 13 '20 at 16:05
  • i don't know how use Regex function to detect begin and end with same character of a string, so that"s why asked qt here – wissem chiha Oct 13 '20 at 16:07
  • 1
    Search for “regex character class”, “regex back reference”, “regex anchors”. – user2864740 Oct 13 '20 at 16:10
  • 2
    [Here's a good playground site](https://regex101.com/) to use when trying to figure these things out. You'll want to set the flavor to "ECMAScript (JavaScript)". Also, use the quick reference in the bottom right to help narrow down what you want. To help you get started, try searching that quick reference for "subpattern" – Joseph Marikle Oct 13 '20 at 16:10

1 Answers1

0
let re = /^([aeiou]).*\1$/;
let result = "testing".match(re);

The key here is \1 which is a backreference to the first capturing group.

I'll leave it to you to pack this into a function since I don't fully understand the return values you want here.

ReallyMadeMeThink
  • 1,041
  • 7
  • 11