-1

I've been trying hard to solve a problem using Js. I must define a function using RegExp that allows only 3 char words in which:

  • The first two characters must be between a-z, excluding b

  • The last character must be z or v

Tried to build many expressions but none of them seemed to work.

Help pls :c

  • 1
    If you show us what you have so far we can help you find why it's not working. Preferably include the program and inputs you're testing with. – mbethke Oct 25 '16 at 00:48

2 Answers2

0

^[a|c-z]{2,2}[z|v]$ will perfectly match.

JJJ
  • 32,902
  • 20
  • 89
  • 102
Sphinx117
  • 97
  • 1
  • 5
-1

This regular expression will work for you: var regex = /(a|[c-z]){2}(v|z)/

Dario
  • 582
  • 1
  • 5
  • 17