Jump to content

Recommended Posts

Posted

Yah it's me again,

OK I have a script that reads from a gui a line of text; sometimes the tesxt is not

what I need, i.e. http/www something. I only want the string when it does not

have this format. The text changes sort of like adds.

I have looked at some of the examples but I do not get the aproach.

I need to get the string,

evaluate the string

if contains unwanted text, get string again,

max retry count so it does not loop.

Posted

Maybe...

$url1 = "http/google.com"
$url2 = "http://www.google.com"

MsgBox (0, "", _IsValid($url1))
MsgBox (0, "", _IsValid($url2))

;Returns 1 for valid, 0 for invalid.
Func _IsValid ($url)
    Return StringRegExp ($url, "(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?")
EndFunc
Posted

I believe StringInSr is what you want.

StringInStr

--------------------------------------------------------------------------------

Checks if a string contains a given substring.

StringInStr ( "string", "substring" [, casesense [, occurrence [, start [, count]]]] )

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
×
×
  • Create New...