Regex Match - Word must include at least 1 upper case letter and at least 1 digit. Length should be 8 or more than 8

I’m struggling to create a regex match for the following conditions,

  1. Word must include at least 1 upper case letter and at least 1 digit
  2. Length of the word should be 8 or more than 8
  3. No spaces should be there

Appreciate your help on this.

Hi @Tharusha_Jayadeera

Could you please share any sample input and the output you are looking for?

1 Like


Got a sample and outputs?

“7P 1111951460 84VV3G3I”

I need to match - 84VV3G3I from the above text


Try this pattern:
Preview result here

Have you got additional samples to help us understand more?



This match allows only digits and only letters as well.

But it needs to have at least 1 upper case letters and at least 1 digit both to match


You might need to add a second step where it check for a Capital Letters.

Like try this regex pattern:
Then count the results -

0 = valid
<0 = invalid

@prasath17 - any thoughts?

Hi @Tharusha_Jayadeera could you just try this

Where var will be your input…This is an sample expression , but you can edit it accourding to your logic

1 Like

You can check here…

1 Like


this pattern does not match 84VV3G3I from this “7P 1111951460 84VV3G3I”

@Tharusha_Jayadeera let me give you the exact expression itself

Hi this does not match 84VV3G3I

Hi @Tharusha_Jayadeera could you try this
((?=. \d)(?=. [A-Z]).{8,32})
for spaces include /s

Hi @nikhil.girish
Thanks for following up. But still the same. It does not match



If you need to consider unicode letters also, test with the pattern below:



Wow, I think this will work. This accepts lower case as well. But I think I can manage that.
@ptrobot Thanks a lot.

Thank you for the support @prasath17, @Steven_McKeering, @nikhil.girish

1 Like

Hi @Tharusha_Jayadeera,
You are welcome! Just out of curiosity, in which scenario does it match lower case that you don’t want? If you don’t want it to match lower case at all you can just change it to:


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.