Quantcast
Channel: Adobe Community : Unanswered Discussions - ColdFusion
Viewing all articles
Browse latest Browse all 5794

Regex - string must contain 6-20 characters, with at least 2 digits (don't have to be consecutive) and any number of alphabetic characters

$
0
0

I am trying to write  a regex expression to match a string that is between 6 and 20 characters long, has at least 2 digits that do not have to be consecutive, and any number of alphabetic characters that do not have to be consecutive. All non-case sensitive. I've gotten this far, but it's still not working:

 

^(?=\D*\d{2,}).{6,20}$

 

Should match "abc3def1", but it doesn't because the digits aren't consecutive even though there are two of them. This does match: "abc34def1".

 

Please help!


Viewing all articles
Browse latest Browse all 5794

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>