Match starts with X, which is followed by 3 to 6 capital words or numbers, must containt at least one letter and can have optional dash -.
Example of matches:
XABC
XA-BC8D
X-ABC
XB72D-
Example of non-matches:
X123 //no letters
XAB //too short
XABC-123 //too long
XA--BC //too many -
I tried with X(?=.{3,6}$)[A-Z0-9]*-?[A-Z0-9]*
, but it has many problems. It can match something like X---
. Regex should be compatible with grep.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…