RegEx and URL

     Dim rg As New RegEx
     err_flag=( Nil)

I found this RegEx on the web… but it seems to return TRUE regardless of what I pass it…

123 returns TRUE… expected returns true. NOT expected.

doesn’t it need http as well as https???

Patterns within Xojo should not contain delimiters like “/” and will not recognize trailing switches ("/i"
at the end of the pattern, meaning “case-insensitive”).


That seems to work fine.

To be clear, other languages like perl or PHP require the pattern to be surrounded by delimiters like “/pattern/”. With the RegEx class, you just need “pattern”, and any delimiters would be considered part of the pattern.

Thanks… I did copy that from a PHP oriented site.

and yes… that does work :slight_smile:

The tokens “https?” means “h-t-t-p, then, optionally, s” (signified by the “?” after the “s”). It would match both “http” and “https”.

The “|” after that section means “or”, so it would also match the “ftp” that follows.

perfect… no matter how hard I try I just cannot wrap my brain around anything beyond simple RegEx…