From: Kenneth A. Larsen on

"Kenneth A. Larsen" <kuhlpc#2(a)optimum.net> wrote in message
news:%23NUeGTQMLHA.2100(a)TK2MSFTNGP06.phx.gbl...
>
> "Mayayana" <mayayana(a)invalid.nospam> wrote in message
> news:i316um$p7g$1(a)news.eternal-september.org...
>>I don't use RegExp, but in case you don't
>> find an answer you can also use a simple
>> function:
>>
>> Function IsValid(s1)
>> Dim i2, Asc1
>> IsValid = False
>> If Len(s1) > 32 Then Exit Function
>> If Len(s1) = 0 Then IsValid = True: Exit Function
>> For i2 = 1 to Len(s1)
>> Asc1 = Asc(mid(s1, i2, 1))
>> Select Case Asc1
>> Case 44, 45, 95
>> '--
>> Case Else
>> If ((Asc1 > 64) And (Asc1 < 91)) Or ((Asc1 > 96) And (Asc1 <
>> 123)) Or ((Asc1 > 47) And (Asc1 < 58)) Then
>> '--
>> Else
>> Exit Function
>> End If
>> End Select
>> Next
>> IsValid = True
>> End Function
>>
>> |
>> | I use this function:
>> |
>> | Function ValidateField(strInput, txtRegExp)
>> | Set re = new regexp
>> | re.Pattern = txtRegExp
>> | re.IgnoreCase=true
>> | ValidateField=re.Test(strInput)
>> | set re = Nothing
>> | End Function
>> |
>> | to validate text field values against regular expressions. I'm no
>> wizard
>> | when it comes to regexps. I got 99% of the text fields covered, except
>> for
>> | this one:
>> |
>> | The text field:
>> |
>> | * can be empty
>> | * can be a single alphanumeric string with up to 32 characters
>> | * must not contain any spaces or any non-alphanumeric characters except
>> | underscore, dash and comma
>> | * can be a comma separated list of up to 10 strings as defined above,
>> e.g
>> .
>> | "entry1,entry2,veryveryverylongentry3"
>> |
>> |
>> | Can this be done by a regular expression?
>> |
>> | Tom
>> |
>> |
>>
>>
>
>


From: Kenneth A. Larsen on

"Kenneth A. Larsen" <kuhlpc#2(a)optimum.net> wrote in message
news:%23NUeGTQMLHA.2100(a)TK2MSFTNGP06.phx.gbl...
>
> "Mayayana" <mayayana(a)invalid.nospam> wrote in message
> news:i316um$p7g$1(a)news.eternal-september.org...
>>I don't use RegExp, but in case you don't
>> find an answer you can also use a simple
>> function:
>>
>> Function IsValid(s1)
>> Dim i2, Asc1
>> IsValid = False
>> If Len(s1) > 32 Then Exit Function
>> If Len(s1) = 0 Then IsValid = True: Exit Function
>> For i2 = 1 to Len(s1)
>> Asc1 = Asc(mid(s1, i2, 1))
>> Select Case Asc1
>> Case 44, 45, 95
>> '--
>> Case Else
>> If ((Asc1 > 64) And (Asc1 < 91)) Or ((Asc1 > 96) And (Asc1 <
>> 123)) Or ((Asc1 > 47) And (Asc1 < 58)) Then
>> '--
>> Else
>> Exit Function
>> End If
>> End Select
>> Next
>> IsValid = True
>> End Function
>>
>> |
>> | I use this function:
>> |
>> | Function ValidateField(strInput, txtRegExp)
>> | Set re = new regexp
>> | re.Pattern = txtRegExp
>> | re.IgnoreCase=true
>> | ValidateField=re.Test(strInput)
>> | set re = Nothing
>> | End Function
>> |
>> | to validate text field values against regular expressions. I'm no
>> wizard
>> | when it comes to regexps. I got 99% of the text fields covered, except
>> for
>> | this one:
>> |
>> | The text field:
>> |
>> | * can be empty
>> | * can be a single alphanumeric string with up to 32 characters
>> | * must not contain any spaces or any non-alphanumeric characters except
>> | underscore, dash and comma
>> | * can be a comma separated list of up to 10 strings as defined above,
>> e.g
>> .
>> | "entry1,entry2,veryveryverylongentry3"
>> |
>> |
>> | Can this be done by a regular expression?
>> |
>> | Tom
>> |
>> |
>>
>>
>
>


From: Kenneth A. Larsen on

"Tom Tyson" <no(a)spam.org> wrote in message
news:i2u251$3rr$1(a)newsreader5.netcologne.de...
> Hey guys,
>
> I use this function:
>
> Function ValidateField(strInput, txtRegExp)
> Set re = new regexp
> re.Pattern = txtRegExp
> re.IgnoreCase=true
> ValidateField=re.Test(strInput)
> set re = Nothing
> End Function
>
> to validate text field values against regular expressions. I'm no wizard
> when it comes to regexps. I got 99% of the text fields covered, except for
> this one:
>
> The text field:
>
> * can be empty
> * can be a single alphanumeric string with up to 32 characters
> * must not contain any spaces or any non-alphanumeric characters except
> underscore, dash and comma
> * can be a comma separated list of up to 10 strings as defined above, e.g
> .
> "entry1,entry2,veryveryverylongentry3"
>
>
> Can this be done by a regular expression?
>
> Tom
>
>


From: Tom Tyson on
"Steve" <cerberus40+usenet(a)gmail.com> wrote in message
news:i319k3$9na$1(a)news.eternal-september.org...
> Tom Tyson wrote:
>>
>> The text field:
>>
>> * can be empty
>> * can be a single alphanumeric string with up to 32 characters
>> * must not contain any spaces or any non-alphanumeric characters
>> except underscore, dash and comma
>
> Doesn't "alphanumeric characters" exclude underscore and dash? (Also,
> comma; but commas are used a separators in the next point.) The pattern
> will assume that "alphanumeric characters" includes underscores and
> dashes.
>
>> * can be a comma separated list of up to 10 strings as defined above,
>> e.g . "entry1,entry2,veryveryverylongentry3"
>
> txtRegExp = "^(?:[0-9a-z\-_]{1,32}(?:,[0-9a-z\-_]{1,32}){0,9})?$"
>
> --
> Steve
>
> I don't divide the world into the weak and the strong, or the successes
> and the failures, those who make it or those who don't. I divide the
> world into learners and non-learners. -Benjamin Barber
>

Steve,

thanks! Works perfectly. I meant to say that only alphanumeric characters
plus underscore and dash are allowed.


From: Kenneth A. Larsen on

"Kenneth A. Larsen" <kuhlpc#2(a)optimum.net> wrote in message
news:eMx%23jGXMLHA.3668(a)TK2MSFTNGP04.phx.gbl...
>
> "Kenneth A. Larsen" <kuhlpc#2(a)optimum.net> wrote in message
> news:%23NUeGTQMLHA.2100(a)TK2MSFTNGP06.phx.gbl...
>>
>> "Mayayana" <mayayana(a)invalid.nospam> wrote in message
>> news:i316um$p7g$1(a)news.eternal-september.org...
>>>I don't use RegExp, but in case you don't
>>> find an answer you can also use a simple
>>> function:
>>>
>>> Function IsValid(s1)
>>> Dim i2, Asc1
>>> IsValid = False
>>> If Len(s1) > 32 Then Exit Function
>>> If Len(s1) = 0 Then IsValid = True: Exit Function
>>> For i2 = 1 to Len(s1)
>>> Asc1 = Asc(mid(s1, i2, 1))
>>> Select Case Asc1
>>> Case 44, 45, 95
>>> '--
>>> Case Else
>>> If ((Asc1 > 64) And (Asc1 < 91)) Or ((Asc1 > 96) And (Asc1 <
>>> 123)) Or ((Asc1 > 47) And (Asc1 < 58)) Then
>>> '--
>>> Else
>>> Exit Function
>>> End If
>>> End Select
>>> Next
>>> IsValid = True
>>> End Function
>>>
>>> |
>>> | I use this function:
>>> |
>>> | Function ValidateField(strInput, txtRegExp)
>>> | Set re = new regexp
>>> | re.Pattern = txtRegExp
>>> | re.IgnoreCase=true
>>> | ValidateField=re.Test(strInput)
>>> | set re = Nothing
>>> | End Function
>>> |
>>> | to validate text field values against regular expressions. I'm no
>>> wizard
>>> | when it comes to regexps. I got 99% of the text fields covered, except
>>> for
>>> | this one:
>>> |
>>> | The text field:
>>> |
>>> | * can be empty
>>> | * can be a single alphanumeric string with up to 32 characters
>>> | * must not contain any spaces or any non-alphanumeric characters
>>> except
>>> | underscore, dash and comma
>>> | * can be a comma separated list of up to 10 strings as defined above,
>>> e.g
>>> .
>>> | "entry1,entry2,veryveryverylongentry3"
>>> |
>>> |
>>> | Can this be done by a regular expression?
>>> |
>>> | Tom
>>> |
>>> |
>>>
>>>
>>
>>
>
>