VB-->PHP
| From: | Jay | Date: | Thu, 29 Jul 2004 09:00:08 +0000 |
| Subject: | VB-->PHP | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-192162@lists.php.net to get a copy of this message | ||
Hi!
Can someone pelase help me to convert the following Vbscript code to PHP, i am really sucky at Regular Expression:
---------CODE VBSCRIPT---------------------
Function IsValid(strData,blIncludeAlpha,blIncludeNumeric)
Dim regEx, retVal,strPtrn
Set regEx = New RegExp
If blIncludeAlpha Then
strPtrn="a-zA-Z"
End If
If blIncludeNumeric Then
strPtrn="0-9"
End If
if blIncludeAlpha and blIncludeNumeric Then
strPtrn="a-zA-Z0-9"
End if
regEx.Pattern = "^[" & strPtrn & "]+$"
IsValid= regEx.Test(strData)
End Function