1

I want a code that doesn't kick Name_Surname but kicks anything else. My current code is :

^(?![A-Z][a-z]+(?:_[A-Z][a-z]+)*).*$

I need one more rule to add to this code.

I want to allow [C]Name_Surname format too.

This C letter can change for max 3 letters long for example [CAD]Name_Surname but not allow [CADS]Name_Surname

https://regex101.com/r/pbz4LP/1

Simply I want to allow match4 match5 and match6 from this link but not allow match7

Toto
  • 19,304
Enis
  • 11

1 Answers1

0

Just modify a bit your actual regex into:

^(?!\[[A-Z]{1,3}\].*$)(?![A-Z][a-z]+(?:_[A-Z][a-z]+)+$).*

Demo & Explanation

Toto
  • 19,304