realbasic-nug
[Top] [All Lists]

Re: Validate URL

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Validate URL
From: Phil M <phil at mobleybros dot com>
Date: Thu, 31 Aug 2006 10:55:55 -0700
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <4D4FE5BC-9474-4F41-A279-8CCED96FB8B4 at jettfuel dot net> <020c01c6cca3$5dd7ff10$6401a8c0 at HP> <fed2e2560608311021x3edb7493m9d6511a09b1b348d at mail dot gmail dot com> <22BC1D60-43FC-4A72-8610-6E71AE909944 at declareSub dot com>
On Aug 31, 2006, at 10:38 AM, Charles Yeomans wrote:

  dim r as new RegEx
r.SearchPattern = "(([a-zA-Z][0-9a-zA-Z+\\-\\.]*:)?/{0,2}[0-9a-zA- Z;/?:@&=+$\\.\\-_!~*'()%]+)?(#[0-9a-zA-Z;/?:@&=+$\\.\\-_!~*'()%]+)?"

  dim match as RegExMatch = r.Search(EditField1.Text)
  if match <> nil then
    MsgBox "Validated: " + match.SubExpressionString(0)
  else
    MsgBox "Failed."
  end if

But it's not clear to me that this regular expression does quite what one expects.

All this RegEx really does is verify that a URL is within the contents of the string... you can have 100 pages of data and it will locate the first URL. As written, this search pattern does not verify that the entire source string is a valid URL.


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>