0

I have the following regex:

[a-z][^b|j|m|n]{5} 

However, it only matches 6 characters and not the specified 5?

2
  • What programming language or tool are you using? Commented May 28, 2013 at 16:00
  • gskinner.com/RegExr Commented May 28, 2013 at 16:05

2 Answers 2

5

[^b|j|m|n]{5} would match 5 characters, and [a-z] would be the 6th.

Sign up to request clarification or add additional context in comments.

Comments

4

You may want to use

[ac-iklo-z]{5} 

instead. This will only match the desired characters for all five characters. If you really do want to match "any alphabetic character followed by any single character except b,j,m,n" for a total of five characters, it would be

[a-z][^bjmn]{4} 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.