-4

Fairly new to regex, looking to identify a user id pattern that is all alpha, is exactly 6 characters, and the second character is always a Z. Any help would be appreciated.

2 Answers2

0

How about this regex:

\w(Z|z)\w{4}

Is this what you want?

Chris Ruehlemann
  • 20,321
  • 4
  • 12
  • 34
0

As I understood you want something to detect something like this:

jZabcd

What you could do is something like this:

[A-Za-z][Z]([A-Za-z]{4})

Breakdown:

[A-Za-z] = detects all alpha big and small letters only once.

[Z] = checks if there is only a big "Z".

() = a group to make it easier.

{4} = checks if there is 4 times from what was infront of the 4.

[A-Za-z]{4} = checks if there are 4 letters from big A-Z and small a-z.

I hope this helps you out and please expand your question next time a little more.

Makusium
  • 201
  • 1
  • 2
  • 15