Java Regex Patterns

User Generated

wubnat

Programming

Description

I currently have this following java regex pattern: C[0-9A-Z]{9}\\s 

It currently matches substring's in a string that begin with C only contain 0-9 and A-Z, is 10 characters long including the C and has a space after it. I need it to limit its matches to something that MUST include atleast one digit as well. How can i add this into my regex?

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

\d+ in regex means 1 or more numbers. So in your case: C[A-Z]\d+{9}\\s


Anonymous
Excellent resource! Really helped me get the gist of things.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags