Hey everyone--

I know this question will be simple for many of you. I feel like I've wasted enough time trying to figure this one out myself. Anyway, I am trying to match a URL using ereg. Example:

I want to match URLS like this:

http://www.blainevess.com/file.html

The URL cannot contain subdirectories, like this:

http://www.blainevess.com/subdirectory/file.html

How would I go about matching a URL like the first one I have listed above? Thanks in advance!

Blaine

    12 years later

    Iam looking for list of useful patterns that run with ereg. Any help

      First, there's no point trying to find one to work with [man]ereg[/man] since that is completely obsolete and has been for some years.

      Second, RFC3986, which specifies the URL format, provides a regular expression. for matching URLs (see Appendix 😎.

        Write a Reply...