Jump to content
Sign in to follow this  
SetEnv

RegExp problem

Recommended Posts

SetEnv

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

Share this post


Link to post
Share on other sites
SetEnv

Yep that's it!

I searched trough the help file but didn't find anythig...

Thanks ! :-D

Share this post


Link to post
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
Sign in to follow this  

×