Regular Expressions 101

Community Patterns

Regex to capture AlphaNumeric String of 7 or 11 length(Must contain at least one Alphabet and Must contain at least one Numeric)

0

Regular Expression
Java 8

"
\s(?=\w*[0-9])(?=\w*[A-Z])([A-Z\d]{11}|[A-Z\d]{7})\s
"
g

Description

Regex to capture AlphaNumeric String

  • Length should be 7 or 11
  • Must contain at least one Alphabet
  • Must contain at least one Numeric
Submitted by Suman Maharjan - 3 years ago