>After the strings all pass the RE, do something like this (shot from the
>hip, with no testing):
>
><cfset s = structNew() />
><cfloop list="#form.serialnum#" index="num">
> <cfset prefix = left(num, 3) />
> <cfset num = removeChars(num, 1, 3) />
> <cfif structKeyExists(s, prefix)>
> <cfset s[prefix] = listAppend(s[prefix], num) />
> <cfelse>
> <cfset s[prefix] = num />
> </cfif>
></cfloop>
>
><cfloop collection="#s#" item="prefix">
> <cfif listLen(s[prefix]) GT 1>
> <cfset s[prefix] = listSort(s[prefix], "numeric") />
> <cfset last = -10 />
> <cfloop list="#s[prefix]#" index="num">
> <cfif num - last LTE 5>
> <cfthrow type="InvalidSerialException"
> message="the #prefix##num# serial is invalid" />
> </cfif>
> <cfset last = num />
> </cfloop>
> </cfif>
></cfloop>
>
><cfoutput>the serials are all valid</cfoutput>
>
>Cheers,
>barneyb
>
>
>>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

