From: "Kevin A. McGrail" <kmcgr...@pccc.com> Date: Wed, 26 Feb 2014 19:06:34 -0500 On 2/26/2014 6:53 PM, Webmaster wrote: > I need a regex to match an alphanumeric string with letters and numbers. > > example: 48HQZBF404TY2298D1414BB8050022YQ3872444 > > The pattern is defined as: > > A sequence of alphanumeric characters, letters are upper or lower > case, at least 30 chars long, containing at least 10 numbers. > > This part is easy enough: [a-zA-Z0-9]{30,} > > But I can't figure out how to match only ifthe string contains at > least 10 numbers. Hmm, I think you might need a plugin for that one.
Can't you do something like this using a look ahead regexp? (?=[A-Z0-9]{30,})(?:[A-Z]*[0-9]){10,} The look ahead gets the 30 chars. Then the next part gets the 10 or more numbers. You probably don't need unbounded {10,} but you do need the {30,} part to be unbounded. Is the 10 number part really important? -jeff