Jump to content

RegExp problem


SetEnv
 Share

Recommended Posts

Hello,

I'm not really familiar with regexp,but i'm trying to create a "IsIp" Function.

This function just need to verify if the item is like *.*.*.* and if ip is correct (1.1.1.1 -> 254.254.254.254)

Here is my first try, but I don't know if the regexp is correct.

If someone expert with this could help me, it will be nice !

Thanks in advance =)

Func Isip($xisip) ;this Function isn't yet created.
    Local $IsipSplit = StringSplit($xisip, "."), $IsIpCnt = $IsipSplit[0]
    
    If $IsIpCnt <> "4" Then Return "False"
    If $IsIpCnt == "4" Then
        While $IsIpCnt > "0" 
            $xisiptemp = StringRegExp($IsipSplit[$IsIpCnt],'1-254') 
            If $xisiptemp <> 1  Then Return "False"
            $IsIpCnt -= 1
        WEnd
        Return "True"
    EndIf
EndFunc ; ==> EndFunc 'Isip($xisip)'
Edited by SetEnv
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...