Jump to content

Parsing a string, where to start.


Recommended Posts

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

I believe StringInSr is what you want.

StringInStr

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

Checks if a string contains a given substring.

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

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...