realbasic-nug
[Top] [All Lists]

Re: finding links with RegEx?

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: finding links with RegEx?
From: Thomas Reed <thomasareed at earthlink dot net>
Date: Wed, 27 Feb 2002 17:40:59 -0600
>Off the top of my head:
>
>(src|background|href)="?([^\s"]+)[\s"]

This works, and seems to work well, except for a couple things.

First, it doesn't handle line breaks well.  For example, suppose there's
a break like this:

................................ SRC =
"somelink.html" ...

This would be skipped, but I need to match it.  (Handling returns has
always been a problem for me in regular expressions before.)

Second, I want to make sure this only matches if the text in question is
somewhere inside a pair of angle brackets.

For example, I don't want to match the link in a case like this:

<P>To display a link on your web page, do the following:</P>

<P>&lt;A HREF="samplelink.html"&gt;</P>

How can I extend this to handle these two conditions?

-Thomas

Personal web page:                 http://home.earthlink.net/~thomasareed/
My shareware:            http://home.earthlink.net/~thomasareed/shareware/
Pixel Pen web pub. guide: http://home.earthlink.net/~thomasareed/pixelpen/

The bus station is the place where the bus stops. The train station is the
place where the train stops. So if I have a workstation...



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